svn commit: r352558 - head/usr.bin/top

2019-09-20 Thread Daichi GOTO
Author: daichi
Date: Fri Sep 20 17:37:23 2019
New Revision: 352558
URL: https://svnweb.freebsd.org/changeset/base/352558

Log:
  top(1): support multibyte characters in command names (ARGV array)
  depending on locale.
  
   - add setlocale()
   - remove printable() function
   - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
 non-printable characters that do not use C-style backslash sequences
 in three digit octal sequence, or remove it
  
  This change allows multibyte characters to be displayed according to
  locale. If it is recognized as a non-display character according to the
  locale, it is displayed in three digit octal sequence.
  
  Reference:
  https://www.mail-archive.com/svn-src-all@freebsd.org/msg165751.html
  https://www.mail-archive.com/svn-src-all@freebsd.org/msg165766.html
  https://www.mail-archive.com/svn-src-all@freebsd.org/msg165833.html
  https://www.mail-archive.com/svn-src-all@freebsd.org/msg165846.html
  https://www.mail-archive.com/svn-src-all@freebsd.org/msg165891.html
  
  Submitted by: hrs
  Differential Revision: https://reviews.freebsd.org/D16204

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/display.h
  head/usr.bin/top/machine.c
  head/usr.bin/top/top.1
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Fri Sep 20 13:35:28 2019(r352557)
+++ head/usr.bin/top/display.c  Fri Sep 20 17:37:23 2019(r352558)
@@ -1291,31 +1291,6 @@ line_update(char *old, char *new, int start, int line)
 }
 }
 
-/*
- *  printable(str) - make the string pointed to by "str" into one that is
- * printable (i.e.: all ascii), by converting all non-printable
- * characters into '?'.  Replacements are done in place and a pointer
- * to the original buffer is returned.
- */
-
-char *
-printable(char str[])
-{
-char *ptr;
-char ch;
-
-ptr = str;
-while ((ch = *ptr) != '\0')
-{
-   if (!isprint(ch))
-   {
-   *ptr = '?';
-   }
-   ptr++;
-}
-return(str);
-}
-
 void
 i_uptime(struct timeval *bt, time_t *tod)
 {

Modified: head/usr.bin/top/display.h
==
--- head/usr.bin/top/display.h  Fri Sep 20 13:35:28 2019(r352557)
+++ head/usr.bin/top/display.h  Fri Sep 20 17:37:23 2019(r352558)
@@ -11,7 +11,6 @@ intdisplay_updatecpus(struct statics *statics);
 voidclear_message(void);
 int display_resize(void);
 voidi_header(const char *text);
-char   *printable(char *string);
 voiddisplay_header(int t);
 int display_init(struct statics *statics);
 voidi_arc(int *stats);

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Fri Sep 20 13:35:28 2019(r352557)
+++ head/usr.bin/top/machine.c  Fri Sep 20 17:37:23 2019(r352558)
@@ -1003,7 +1003,7 @@ format_next_process(struct handle * xhandle, char *(*g
len = (argbuflen - (dst - argbuf) - 1) / 4;
strvisx(dst, src,
MIN(strlen(src), len),
-   VIS_NL | VIS_CSTYLE);
+   VIS_NL | VIS_CSTYLE | VIS_OCTAL | VIS_SAFE);
while (*dst != '\0')
dst++;
if ((argbuflen - (dst - argbuf) - 1) / 4 > 0)
@@ -1102,7 +1102,7 @@ format_next_process(struct handle * xhandle, char *(*g
sbuf_printf(procbuf, "%6s ", format_time(cputime));
sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * 
weighted_cpu(PCTCPU(pp), pp) : 100.0 * PCTCPU(pp));
}
-   sbuf_printf(procbuf, "%s", printable(cmdbuf));
+   sbuf_printf(procbuf, "%s", cmdbuf);
free(cmdbuf);
return (sbuf_data(procbuf));
 }

Modified: head/usr.bin/top/top.1
==
--- head/usr.bin/top/top.1  Fri Sep 20 13:35:28 2019(r352557)
+++ head/usr.bin/top/top.1  Fri Sep 20 17:37:23 2019(r352558)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd October 2, 2018
+.Dd September 20, 2019
 .Dt TOP 1
 .Os
 .Sh NAME
@@ -192,6 +192,10 @@ or
 \*(lqall\*(rq.
 Boolean flags are toggles.
 A second specification of any of these options will negate the first.
+.Pp
+The display of command names changes according to the locale.
+If command names displayed in the locale settings are recognized as 
+non-display characters, they are displayed in three digit octal sequence.
 .Sh "INTERACTIVE MODE"
 When
 .Nm

Modified: head/usr.bin/top/top.c
==
--- head/usr.bin/top/top.c  Fri Sep 20 13:35:28 2019

svn commit: r336756 - head/usr.bin/top

2018-07-27 Thread Daichi GOTO
Author: daichi
Date: Fri Jul 27 07:05:50 2018
New Revision: 336756
URL: https://svnweb.freebsd.org/changeset/base/336756

Log:
  top(1): fix a buffer overflow copying states to display while they were 
incremented
  
- fix an AddressSanitizer error
  
  Submitted by: devne...@gmail.com
  Reviewed by:  eadler
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16183

Modified:
  head/usr.bin/top/display.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Fri Jul 27 05:40:03 2018(r336755)
+++ head/usr.bin/top/display.c  Fri Jul 27 07:05:50 2018(r336756)
@@ -420,6 +420,7 @@ i_cpustates(int *states)
 int value;
 const char * const *names;
 const char *thisname;
+int *hstates = states;
 int cpu;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
@@ -453,6 +454,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 }
 
 /* copy over values into "last" array */
+states = hstates;
 memcpy(lcpustates, states, num_cpustates * sizeof(int) * num_cpus);
 }
 
@@ -462,6 +464,7 @@ u_cpustates(int *states)
 int value;
 const char * const *names;
 const char *thisname;
+int *hstates = states;
 int *lp;
 int *colp;
 int cpu;
@@ -504,6 +507,8 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
colp++;
 }
 }
+
+states = hstates;
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336753 - head/usr.bin/top

2018-07-26 Thread Daichi GOTO
Author: daichi
Date: Fri Jul 27 01:20:34 2018
New Revision: 336753
URL: https://svnweb.freebsd.org/changeset/base/336753

Log:
  top(1): fixed the empty output problem in non-interactive mode (-n, -b) 
regressed in r336028
  
  PR:   229842
  Reported by:  Ali Abdallah 
  Reviewed by:  eadler, cy
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16455

Modified:
  head/usr.bin/top/screen.c

Modified: head/usr.bin/top/screen.c
==
--- head/usr.bin/top/screen.c   Thu Jul 26 22:55:51 2018(r336752)
+++ head/usr.bin/top/screen.c   Fri Jul 27 01:20:34 2018(r336753)
@@ -54,6 +54,8 @@ static struct termios old_settings;
 static struct termios new_settings;
 static char is_a_terminal = false;
 
+#define NON_INTERACTIVE_MODE_VIRTUAL_SCREEN_WIDTH 1024
+
 void
 init_termcap(bool interactive)
 {
@@ -68,6 +70,7 @@ init_termcap(bool interactive)
 if (!interactive)
 {
/* pretend we have a dumb terminal */
+   screen_width = NON_INTERACTIVE_MODE_VIRTUAL_SCREEN_WIDTH;
smart_terminal = false;
return;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336737 - head/usr.bin/top

2018-07-26 Thread Daichi GOTO
Author: daichi
Date: Thu Jul 26 13:53:22 2018
New Revision: 336737
URL: https://svnweb.freebsd.org/changeset/base/336737

Log:
  top(1): forgot in r336160
  
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16452

Modified:
  head/usr.bin/top/utils.h

Modified: head/usr.bin/top/utils.h
==
--- head/usr.bin/top/utils.hThu Jul 26 13:33:10 2018(r336736)
+++ head/usr.bin/top/utils.hThu Jul 26 13:53:22 2018(r336737)
@@ -22,5 +22,4 @@ const char *format_time(long);
 char *format_k(int64_t);
 int string_index(const char *string, const char * const *array);
 int find_pid(pid_t pid);
-int utf8strvisx(char *, const char *, size_t);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336160 - head/usr.bin/top

2018-07-09 Thread Daichi GOTO
10 03:03:10 2018(r336159)
+++ head/usr.bin/top/top.h  Tue Jul 10 03:49:48 2018(r336160)
@@ -8,7 +8,6 @@
 #define TOP_H
 
 #include 
-#include 
 
 /* Number of lines of header information on the standard screen */
 extern int Header_lines;
@@ -35,7 +34,6 @@ extern enum displaymodes displaymode;
 extern int pcpu_stats;
 extern int overstrike;
 extern pid_t mypid;
-extern bool utf8flag;
 
 extern const char * myname;
 

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cTue Jul 10 03:03:10 2018(r336159)
+++ head/usr.bin/top/utils.cTue Jul 10 03:49:48 2018(r336160)
@@ -2,7 +2,6 @@
  *  This program may be freely redistributed,
  *  but this entire comment MUST remain intact.
  *
- *  Copyright (c) 2018, Daichi Goto
  *  Copyright (c) 2018, Eitan Adler
  *  Copyright (c) 1984, 1989, William LeFebvre, Rice University
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
@@ -328,62 +327,4 @@ find_pid(pid_t pid)
 done:
kvm_close(kd);
return ret;
-}
-
-/*
- * utf8strvisx(dst,src,src_len) 
- * strvisx(dst,src,src_len,VIS_NL|VIS_CSTYLE) coresponding to UTF-8.
- */
-static const char *vis_encodes[] = {
-   "\\0", "\\^A", "\\^B", "\\^C", "\\^D", "\\^E", "\\^F", "\\a",
-   "\\b", "\t", "\\n", "\\v", "\\f", "\\r", "\\^N", "\\^O", "\\^P",
-   "\\^Q", "\\^R", "\\^S", "\\^T", "\\^U", "\\^V", "\\^W", "\\^X",
-   "\\^Y", "\\^Z", "\\^[", "\\^\\", "\\^]", "\\^^", "\\^_"
-};
-
-int
-utf8strvisx(char *dst, const char *src, size_t src_len)
-{
-   const signed char *src_p;
-   char *dst_p;
-   int i, j, olen, len;
-
-   src_p = src;
-   dst_p = dst;
-   i = olen = 0;
-   len = (int)src_len;
-   while (i < len) {
-   if (0x00 == (0x80 & *src_p)) {
-   if (0 <= *src_p && *src_p <= 31) {
-   j = strlen(vis_encodes[(int)*src_p]);
-   strcpy(dst_p, vis_encodes[(int)*src_p]);
-   dst_p += j;
-   olen += j;
-   } else if (127 == *src_p) {
-   strcpy(dst_p, "\\^?");
-   olen += 3;
-   } else {
-   *dst_p++ = *src_p;
-   ++olen;
-   }
-   ++i;
-   ++src_p;
-   } else if (0xC0 == (0xE0 & *src_p)) {
-   *dst_p++ = *src_p++; ++i; ++olen;
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   } else if (0xE0 == (0xF0 & *src_p)) {
-   *dst_p++ = *src_p++; ++i; ++olen;
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   } else if (0xF0 == (0xF8 & *src_p)) {
-   *dst_p++ = *src_p++; ++i; ++olen;
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
-   } else {
-   *dst_p++ = '?'; ++i; ++olen;
-   }
-   }
-
-   return olen;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336150 - head/usr.bin/top

2018-07-09 Thread Daichi GOTO
Author: daichi
Date: Tue Jul 10 00:19:52 2018
New Revision: 336150
URL: https://svnweb.freebsd.org/changeset/base/336150

Log:
  top(1): Fix the prompt bug and core dump problem in o / p mode that occurred 
by r336028
  
  Reviewed by:  cy
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16174

Modified:
  head/usr.bin/top/display.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Tue Jul 10 00:18:12 2018(r336149)
+++ head/usr.bin/top/display.c  Tue Jul 10 00:19:52 2018(r336150)
@@ -703,6 +703,7 @@ u_swap(int *stats)
  * respect to screen updates).
  */
 
+#define NEXT_MSG_ADDLEN 5
 static char *next_msg = NULL;
 static int msglen = 0;
 /* Invariant: msglen is always the length of the message currently displayed
@@ -711,7 +712,7 @@ static int msglen = 0;
 void
 i_message(void)
 {
-next_msg = setup_buffer(next_msg, 5);
+next_msg = setup_buffer(next_msg, NEXT_MSG_ADDLEN);
 
 while (lastline < y_message)
 {
@@ -960,7 +961,8 @@ new_message(int type, const char *msgfmt, ...)
 va_start(args, msgfmt);
 
 /* first, format the message */
-vsnprintf(next_msg, strlen(next_msg), msgfmt, args);
+vsnprintf(next_msg, setup_buffer_bufsiz + NEXT_MSG_ADDLEN,
+   msgfmt, args);
 
 va_end(args);
 
@@ -1343,6 +1345,8 @@ i_uptime(struct timeval *bt, time_t *tod)
 }
 }
 
+#define SETUPBUFFER_REQUIRED_ADDBUFSIZ 2
+
 static char *
 setup_buffer(char *buffer, int addlen)
 {
@@ -1350,12 +1354,15 @@ setup_buffer(char *buffer, int addlen)
 
if (NULL == buffer) {
setup_buffer_bufsiz = screen_width;
-   b = calloc(setup_buffer_bufsiz + addlen, sizeof(char));
+   b = calloc(setup_buffer_bufsiz + addlen +
+   SETUPBUFFER_REQUIRED_ADDBUFSIZ,
+   sizeof(char));
} else {
if (screen_width > setup_buffer_bufsiz) {
setup_buffer_bufsiz = screen_width;
free(buffer);
-   b = calloc(setup_buffer_bufsiz + addlen,
+   b = calloc(setup_buffer_bufsiz + addlen +
+   SETUPBUFFER_REQUIRED_ADDBUFSIZ,
sizeof(char));
} else {
b = buffer;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336028 - head/usr.bin/top

2018-07-06 Thread Daichi GOTO
Author: daichi
Date: Fri Jul  6 12:07:06 2018
New Revision: 336028
URL: https://svnweb.freebsd.org/changeset/base/336028

Log:
  Changed to eliminate the upper limit of command length displayed
  by "-a" and expand to match terminal width
  
  Reviewed by:  eadler
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16083

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.c
  head/usr.bin/top/screen.c
  head/usr.bin/top/top.h

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Fri Jul  6 11:50:59 2018(r336027)
+++ head/usr.bin/top/display.c  Fri Jul  6 12:07:06 2018(r336028)
@@ -57,9 +57,8 @@ FILE *debug;
 static int lmpid = 0;
 static int last_hi = 0;/* used in u_process and u_endscreen */
 static int lastline = 0;
-static int display_width = MAX_COLS;
 
-#define lineindex(l) ((l)*display_width)
+#define lineindex(l) ((l)*screen_width)
 
 
 /* things initialized by display_init and used thruout */
@@ -94,6 +93,9 @@ static enum { OFF, ON, ERASE } header_status = ON;
 static void summary_format(char *, int *, const char * const *);
 static void line_update(char *, char *, int, int);
 
+static int setup_buffer_bufsiz = 0;
+static char * setup_buffer(char *, int);
+
 int  x_lastpid =   10;
 int  y_lastpid =   0;
 int  x_loadave =   33;
@@ -138,17 +140,9 @@ display_resize(void)
 
 if (lines < 0)
lines = 0;
-/* we don't want more than MAX_COLS columns, since the machine-dependent
-   modules make static allocations based on MAX_COLS and we don't want
-   to run off the end of their buffers */
-display_width = screen_width;
-if (display_width >= MAX_COLS)
-{
-   display_width = MAX_COLS - 1;
-}
 
 /* now, allocate space for the screen buffer */
-screenbuf = calloc(lines, display_width);
+screenbuf = calloc(lines, screen_width);
 if (screenbuf == NULL)
 {
/* oops! */
@@ -336,7 +330,7 @@ i_timeofday(time_t *tod)
 }
 
 static int ltotal = 0;
-static char procstates_buffer[MAX_COLS];
+static char *procstates_buffer = NULL;
 
 /*
  *  *_procstates(total, brkdn, names) - print the process summary line
@@ -350,6 +344,8 @@ i_procstates(int total, int *brkdn)
 {
 int i;
 
+procstates_buffer = setup_buffer(procstates_buffer, 0);
+
 /* write current number of processes and remember the value */
 printf("%d %s:", total, (ps.thread) ? "threads" :"processes");
 ltotal = total;
@@ -372,9 +368,11 @@ i_procstates(int total, int *brkdn)
 void
 u_procstates(int total, int *brkdn)
 {
-static char new[MAX_COLS];
+static char *new = NULL;
 int i;
 
+new = setup_buffer(new, 0);
+
 /* update number of processes only if it has changed */
 if (ltotal != total)
 {
@@ -551,11 +549,13 @@ z_cpustates(void)
  *for i_memory ONLY: cursor is on the previous line
  */
 
-static char memory_buffer[MAX_COLS];
+static char *memory_buffer = NULL;
 
 void
 i_memory(int *stats)
 {
+memory_buffer = setup_buffer(memory_buffer, 0);
+
 fputs("\nMem: ", stdout);
 lastline++;
 
@@ -567,8 +567,10 @@ i_memory(int *stats)
 void
 u_memory(int *stats)
 {
-static char new[MAX_COLS];
+static char *new = NULL;
 
+new = setup_buffer(new, 0);
+
 /* format the new line */
 summary_format(new, stats, memory_names);
 line_update(memory_buffer, new, x_mem, y_mem);
@@ -580,11 +582,13 @@ u_memory(int *stats)
  *  Assumptions:  cursor is on "lastline"
  *for i_arc ONLY: cursor is on the previous line
  */
-static char arc_buffer[MAX_COLS];
+static char *arc_buffer = NULL;
 
 void
 i_arc(int *stats)
 {
+arc_buffer = setup_buffer(arc_buffer, 0);
+
 if (arc_names == NULL)
return;
 
@@ -599,8 +603,10 @@ i_arc(int *stats)
 void
 u_arc(int *stats)
 {
-static char new[MAX_COLS];
+static char *new = NULL;
 
+new = setup_buffer(new, 0);
+
 if (arc_names == NULL)
return;
 
@@ -616,11 +622,13 @@ u_arc(int *stats)
  *  Assumptions:  cursor is on "lastline"
  *for i_carc ONLY: cursor is on the previous line
  */
-static char carc_buffer[MAX_COLS];
+static char *carc_buffer = NULL;
 
 void
 i_carc(int *stats)
 {
+carc_buffer = setup_buffer(carc_buffer, 0);
+
 if (carc_names == NULL)
return;
 
@@ -635,8 +643,10 @@ i_carc(int *stats)
 void
 u_carc(int *stats)
 {
-static char new[MAX_COLS];
+static char *new = NULL;
 
+new = setup_buffer(new, 0);
+
 if (carc_names == NULL)
return;
 
@@ -652,11 +662,13 @@ u_carc(int *stats)
  *for i_swap ONLY: cursor is on the previous line
  */
 
-static char swap_buffer[MAX_COLS];
+static char *swap_buffer = NULL;
 
 void
 i_swap(int *stats)
 {
+swap_buffer = setup_buffer(swap_buffer, 0);
+
 fputs("\nSwap: ", stdout);
 lastline++;
 
@@ -668,8 +680,10 @@ 

svn commit: r335836 - head/usr.bin/top

2018-07-01 Thread Daichi GOTO
e TOP_H
 
 #include 
+#include 
 
 /* Number of lines of header information on the standard screen */
 extern int Header_lines;
@@ -37,6 +38,7 @@ extern enum displaymodes displaymode;
 extern int pcpu_stats;
 extern int overstrike;
 extern pid_t mypid;
+extern bool utf8flag;
 
 extern const char * myname;
 

Modified: head/usr.bin/top/utils.c
==
--- head/usr.bin/top/utils.cSun Jul  1 01:56:40 2018(r335835)
+++ head/usr.bin/top/utils.cSun Jul  1 05:32:03 2018(r335836)
@@ -2,6 +2,7 @@
  *  This program may be freely redistributed,
  *  but this entire comment MUST remain intact.
  *
+ *  Copyright (c) 2018, Daichi Goto
  *  Copyright (c) 2018, Eitan Adler
  *  Copyright (c) 1984, 1989, William LeFebvre, Rice University
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
@@ -327,4 +328,62 @@ find_pid(pid_t pid)
 done:
kvm_close(kd);
return ret;
+}
+
+/*
+ * utf8strvisx(dst,src,src_len) 
+ * strvisx(dst,src,src_len,VIS_NL|VIS_CSTYLE) coresponding to UTF-8.
+ */
+static const char *vis_encodes[] = {
+   "\\0", "\\^A", "\\^B", "\\^C", "\\^D", "\\^E", "\\^F", "\\a",
+   "\\b", "\t", "\\n", "\\v", "\\f", "\\r", "\\^N", "\\^O", "\\^P",
+   "\\^Q", "\\^R", "\\^S", "\\^T", "\\^U", "\\^V", "\\^W", "\\^X",
+   "\\^Y", "\\^Z", "\\^[", "\\^\\", "\\^]", "\\^^", "\\^_"
+};
+
+int
+utf8strvisx(char *dst, const char *src, size_t src_len)
+{
+   const char *src_p;
+   char *dst_p;
+   int i, j, olen, len;
+
+   src_p = src;
+   dst_p = dst;
+   i = olen = 0;
+   len = (int)src_len;
+   while (i < len) {
+   if (0x00 == (0x80 & *src_p)) {
+   if (0 <= *src_p && *src_p <= 31) {
+   j = strlen(vis_encodes[(int)*src_p]);
+   strcpy(dst_p, vis_encodes[(int)*src_p]);
+   dst_p += j;
+   olen += j;
+   } else if (127 == *src_p) {
+   strcpy(dst_p, "\\^?");
+   olen += 3;
+   } else {
+   *dst_p++ = *src_p;
+   ++olen;
+   }
+   ++i;
+   ++src_p;
+   } else if (0xC0 == (0xE0 & *src_p)) {
+   *dst_p++ = *src_p++; ++i; ++olen;
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   } else if (0xE0 == (0xF0 & *src_p)) {
+   *dst_p++ = *src_p++; ++i; ++olen;
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   } else if (0xF0 == (0xF8 & *src_p)) {
+   *dst_p++ = *src_p++; ++i; ++olen;
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; }
+   } else {
+   *dst_p++ = '?'; ++i; ++olen;
+   }
+   }
+
+   return olen;
 }

Modified: head/usr.bin/top/utils.h
==
--- head/usr.bin/top/utils.hSun Jul  1 01:56:40 2018(r335835)
+++ head/usr.bin/top/utils.hSun Jul  1 05:32:03 2018(r335836)
@@ -22,4 +22,5 @@ const char *format_time(long);
 char *format_k(int64_t);
 int string_index(const char *string, const char * const *array);
 int find_pid(pid_t pid);
+int utf8strvisx(char *, const char *, size_t);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335685 - head/usr.bin/top

2018-06-26 Thread Daichi GOTO
Author: daichi
Date: Wed Jun 27 02:55:30 2018
New Revision: 335685
URL: https://svnweb.freebsd.org/changeset/base/335685

Log:
  top(1): increased the maximum length of command shown by "-a"
  
  Reviewed by:  eadler
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16006

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Wed Jun 27 01:51:17 2018(r335684)
+++ head/usr.bin/top/machine.c  Wed Jun 27 02:55:30 2018(r335685)
@@ -871,7 +871,7 @@ format_next_process(struct handle * xhandle, char *(*g
long p_tot, s_tot;
char *cmdbuf = NULL;
char **args;
-   const int cmdlen = 128;
+   const int cmdlen = 256;
static struct sbuf* procbuf = NULL;
 
/* clean up from last time. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r268210 - stable/10/sys/dev/glxiic

2014-07-03 Thread Daichi GOTO
Author: daichi (ports committer)
Date: Thu Jul  3 10:59:42 2014
New Revision: 268210
URL: http://svnweb.freebsd.org/changeset/base/268210

Log:
  MFC: r267852
  
  Fixed an IIC timing issue between the glxiic master and a slave of
  peripheral devices.  When transmitting (rx) from slave to master,
  sometimes nAKC delays. As a result, some slaves fails their
  transmission.
  
  Submitted by: Masanori OZAWA oz...@ongs.co.jp
  Reviewed by:  brix

Modified:
  stable/10/sys/dev/glxiic/glxiic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/glxiic/glxiic.c
==
--- stable/10/sys/dev/glxiic/glxiic.c   Thu Jul  3 10:49:46 2014
(r268209)
+++ stable/10/sys/dev/glxiic/glxiic.c   Thu Jul  3 10:59:42 2014
(r268210)
@@ -711,6 +711,7 @@ static int
 glxiic_state_master_addr_callback(struct glxiic_softc *sc, uint8_t status)
 {
uint8_t slave;
+   uint8_t ctrl1;
 
GLXIIC_ASSERT_LOCKED(sc);
 
@@ -746,6 +747,13 @@ glxiic_state_master_addr_callback(struct
 
bus_write_1(sc-smb_res, GLXIIC_SMB_SDA, slave);
 
+   if ((sc-msg-flags  IIC_M_RD) != 0  sc-ndata == 1) {
+   /* Last byte from slave, set NACK. */
+   ctrl1 = bus_read_1(sc-smb_res, GLXIIC_SMB_CTRL1);
+   bus_write_1(sc-smb_res, GLXIIC_SMB_CTRL1,
+   ctrl1 | GLXIIC_SMB_CTRL1_ACK_BIT);
+   }
+
return (IIC_NOERR);
 }
 
@@ -811,13 +819,6 @@ glxiic_state_master_rx_callback(struct g
return (IIC_ENOACK);
}
 
-   if (sc-ndata == 1) {
-   /* Last byte from slave, set NACK. */
-   ctrl1 = bus_read_1(sc-smb_res, GLXIIC_SMB_CTRL1);
-   bus_write_1(sc-smb_res, GLXIIC_SMB_CTRL1,
-   ctrl1 | GLXIIC_SMB_CTRL1_ACK_BIT);
-   }
-
if ((status  GLXIIC_SMB_STS_STASTR_BIT) != 0) {
/* Bus is stalled, clear and wait for data. */
bus_write_1(sc-smb_res, GLXIIC_SMB_STS,
@@ -837,6 +838,13 @@ glxiic_state_master_rx_callback(struct g
return (glxiic_state_table[sc-state].callback(sc, status));
}
 
+   if (sc-ndata == 1) {
+   /* Last byte from slave, set NACK. */
+   ctrl1 = bus_read_1(sc-smb_res, GLXIIC_SMB_CTRL1);
+   bus_write_1(sc-smb_res, GLXIIC_SMB_CTRL1,
+   ctrl1 | GLXIIC_SMB_CTRL1_ACK_BIT);
+   }
+
glxiic_start_timeout_locked(sc);
 
return (IIC_NOERR);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r262467 - head/bin/sh

2014-02-24 Thread Daichi GOTO
Author: daichi (ports committer)
Date: Tue Feb 25 03:05:43 2014
New Revision: 262467
URL: http://svnweb.freebsd.org/changeset/base/262467

Log:
  sh: Add -h option to SYNOPSIS
  
  Reviewed by:  jilles
  MFC after:soon

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Tue Feb 25 02:58:11 2014(r262466)
+++ head/bin/sh/sh.1Tue Feb 25 03:05:43 2014(r262467)
@@ -40,14 +40,14 @@
 .Nd command interpreter (shell)
 .Sh SYNOPSIS
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Oo
 .Ar script
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl c Ar string
 .Oo
@@ -55,7 +55,7 @@
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl s
 .Op Ar arg ...
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r262467 - head/bin/sh

2014-02-24 Thread Daichi GOTO
Hi Bryan,

Yeah you are right. But it seems not very important for a change 
like this for .Dd bump.  Even so should I update .Dd ?

2014/02/25 12:08、Bryan Drewery bdrew...@freebsd.org :
 On 2/24/2014 9:05 PM, Daichi GOTO wrote:
 Author: daichi (ports committer)
 Date: Tue Feb 25 03:05:43 2014
 New Revision: 262467
 URL: http://svnweb.freebsd.org/changeset/base/262467
 
 Log:
  sh: Add -h option to SYNOPSIS
 
  Reviewed by:jilles
  MFC after:  soon
 
 Modified:
  head/bin/sh/sh.1
 
 Modified: head/bin/sh/sh.1
 ==
 --- head/bin/sh/sh.1 Tue Feb 25 02:58:11 2014(r262466)
 +++ head/bin/sh/sh.1 Tue Feb 25 03:05:43 2014(r262467)
 @@ -40,14 +40,14 @@
 .Nd command interpreter (shell)
 .Sh SYNOPSIS
 .Nm
 -.Op Fl /+abCEefIimnPpTuVvx
 +.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Oo
 .Ar script
 .Op Ar arg ...
 .Oc
 .Nm
 -.Op Fl /+abCEefIimnPpTuVvx
 +.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl c Ar string
 .Oo
 @@ -55,7 +55,7 @@
 .Op Ar arg ...
 .Oc
 .Nm
 -.Op Fl /+abCEefIimnPpTuVvx
 +.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl s
 .Op Ar arg ...
 
 
 .Dd bump is needed too.
 
 -- 
 Regards,
 Bryan Drewery
 

--
Daichi GOTO
CEO | ONGS Inc.
81-42-316-7945 | dai...@ongs.co.jp | http://www.ongs.co.jp
LinkedIn: http://linkedin.com/in/daichigoto

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

svn commit: r262469 - stable/9/bin/sh

2014-02-24 Thread Daichi GOTO
Author: daichi (ports committer)
Date: Tue Feb 25 04:19:15 2014
New Revision: 262469
URL: http://svnweb.freebsd.org/changeset/base/262469

Log:
  MFC r262467: sh: Add -h option to SYNOPSIS
  
  Reviewed by:  jilles

Modified:
  stable/9/bin/sh/sh.1

Modified: stable/9/bin/sh/sh.1
==
--- stable/9/bin/sh/sh.1Tue Feb 25 03:49:42 2014(r262468)
+++ stable/9/bin/sh/sh.1Tue Feb 25 04:19:15 2014(r262469)
@@ -40,14 +40,14 @@
 .Nd command interpreter (shell)
 .Sh SYNOPSIS
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Oo
 .Ar script
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl c Ar string
 .Oo
@@ -55,7 +55,7 @@
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl s
 .Op Ar arg ...
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r262468 - stable/10/bin/sh

2014-02-24 Thread Daichi GOTO
Author: daichi (ports committer)
Date: Tue Feb 25 03:49:42 2014
New Revision: 262468
URL: http://svnweb.freebsd.org/changeset/base/262468

Log:
  MFC r262467: sh: Add -h option to SYNOPSIS
  
  Reviewed by:  jilles

Modified:
  stable/10/bin/sh/sh.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/sh.1
==
--- stable/10/bin/sh/sh.1   Tue Feb 25 03:05:43 2014(r262467)
+++ stable/10/bin/sh/sh.1   Tue Feb 25 03:49:42 2014(r262468)
@@ -40,14 +40,14 @@
 .Nd command interpreter (shell)
 .Sh SYNOPSIS
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Oo
 .Ar script
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl c Ar string
 .Oo
@@ -55,7 +55,7 @@
 .Op Ar arg ...
 .Oc
 .Nm
-.Op Fl /+abCEefIimnPpTuVvx
+.Op Fl /+abCEefhIimnPpTuVvx
 .Op Fl /+o Ar longname
 .Fl s
 .Op Ar arg ...
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r235243 - stable/9/sys/fs/unionfs

2012-05-10 Thread Daichi GOTO
Author: daichi
Date: Thu May 10 20:35:50 2012
New Revision: 235243
URL: http://svn.freebsd.org/changeset/base/235243

Log:
  MFC: 234867 and 234944
  
  - fixed a vnode lock hang-up issue.
  - fixed an incorrect lock status issue.
  - fixed an incorrect lock issue of unionfs root vnode removed.
(pointed out by keith)
  - fixed an infinity loop issue.
(pointed out by dumbbell)
  - changed to do LK_RELEASE expressly when unlocked.
  - fixed a unionfs_readdir math issue
  
  Submitted by: oz...@ongs.co.jp, Matthew Fleming mflem...@isilon.com

Modified:
  stable/9/sys/fs/unionfs/union_subr.c
  stable/9/sys/fs/unionfs/union_vfsops.c
  stable/9/sys/fs/unionfs/union_vnops.c

Modified: stable/9/sys/fs/unionfs/union_subr.c
==
--- stable/9/sys/fs/unionfs/union_subr.cThu May 10 20:31:08 2012
(r235242)
+++ stable/9/sys/fs/unionfs/union_subr.cThu May 10 20:35:50 2012
(r235243)
@@ -2,8 +2,8 @@
  * Copyright (c) 1994 Jan-Simon Pendry
  * Copyright (c) 1994
  * The Regents of the University of California.  All rights reserved.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  *
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry.
@@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct
uvp = unp-un_uppervp;
dvp = unp-un_dvp;
unp-un_lowervp = unp-un_uppervp = NULLVP;
-
vp-v_vnlock = (vp-v_lock);
vp-v_data = NULL;
-   lockmgr(vp-v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp));
+   vp-v_object = NULL;
+   VI_UNLOCK(vp);
+
if (lvp != NULLVP)
-   VOP_UNLOCK(lvp, 0);
+   VOP_UNLOCK(lvp, LK_RELEASE);
if (uvp != NULLVP)
-   VOP_UNLOCK(uvp, 0);
-   vp-v_object = NULL;
+   VOP_UNLOCK(uvp, LK_RELEASE);
 
if (dvp != NULLVP  unp-un_hash.le_prev != NULL)
unionfs_rem_cached_vnode(unp, dvp);
 
+   if (lockmgr(vp-v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0)
+   panic(the lock for deletion is unacquirable.);
+
if (lvp != NULLVP) {
vfslocked = VFS_LOCK_GIANT(lvp-v_mount);
vrele(lvp);
@@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru
cn-cn_flags |= (cnp-cn_flags  SAVESTART);
 
vref(dvp);
-   VOP_UNLOCK(dvp, 0);
+   VOP_UNLOCK(dvp, LK_RELEASE);
 
if ((error = relookup(dvp, vpp, cn))) {
uma_zfree(namei_zone, cn-cn_pnbuf);
@@ -955,7 +958,7 @@ unionfs_vn_create_on_upper(struct vnode 
*vpp = vp;
 
 unionfs_vn_create_on_upper_free_out1:
-   VOP_UNLOCK(udvp, 0);
+   VOP_UNLOCK(udvp, LK_RELEASE);
 
 unionfs_vn_create_on_upper_free_out2:
if (cn.cn_flags  HASBUF) {

Modified: stable/9/sys/fs/unionfs/union_vfsops.c
==
--- stable/9/sys/fs/unionfs/union_vfsops.c  Thu May 10 20:31:08 2012
(r235242)
+++ stable/9/sys/fs/unionfs/union_vfsops.c  Thu May 10 20:35:50 2012
(r235243)
@@ -1,8 +1,8 @@
 /*-
  * Copyright (c) 1994, 1995 The Regents of the University of California.
  * Copyright (c) 1994, 1995 Jan-Simon Pendry.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  * All rights reserved.
  *
  * This code is derived from software donated to Berkeley by
@@ -165,7 +165,7 @@ unionfs_domount(struct mount *mp)
uid = va.va_uid;
gid = va.va_gid;
}
-   VOP_UNLOCK(mp-mnt_vnodecovered, 0);
+   VOP_UNLOCK(mp-mnt_vnodecovered, LK_RELEASE);
if (error)
return (error);
 
@@ -250,7 +250,7 @@ unionfs_domount(struct mount *mp)
 * Save reference
 */
if (below) {
-   VOP_UNLOCK(upperrootvp, 0);
+   VOP_UNLOCK(upperrootvp, LK_RELEASE);
vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY);
ump-um_lowervp = upperrootvp;
ump-um_uppervp = lowerrootvp;
@@ -281,7 +281,7 @@ unionfs_domount(struct mount *mp)
/*
 * Unlock the node
 */
-   VOP_UNLOCK(ump-um_uppervp, 0);
+   VOP_UNLOCK(ump-um_uppervp, LK_RELEASE);
 
/*
 * Get the unionfs root vnode.

Modified: stable/9/sys/fs/unionfs/union_vnops.c
==
--- stable/9/sys/fs/unionfs/union_vnops.c   Thu May 10 20:31:08 2012
(r235242)
+++ stable/9/sys/fs/unionfs/union_vnops.c   Thu

svn commit: r235244 - stable/8/sys/fs/unionfs

2012-05-10 Thread Daichi GOTO
Author: daichi
Date: Thu May 10 20:37:56 2012
New Revision: 235244
URL: http://svn.freebsd.org/changeset/base/235244

Log:
  MFC: 234867 and 234944
  
  - fixed a vnode lock hang-up issue.
  - fixed an incorrect lock status issue.
  - fixed an incorrect lock issue of unionfs root vnode removed.
(pointed out by keith)
  - fixed an infinity loop issue.
(pointed out by dumbbell)
  - changed to do LK_RELEASE expressly when unlocked.
  - fixed a unionfs_readdir math issue
  
  Submitted by: oz...@ongs.co.jp, Matthew Fleming mflem...@isilon.com

Modified:
  stable/8/sys/fs/unionfs/union_subr.c
  stable/8/sys/fs/unionfs/union_vfsops.c
  stable/8/sys/fs/unionfs/union_vnops.c

Modified: stable/8/sys/fs/unionfs/union_subr.c
==
--- stable/8/sys/fs/unionfs/union_subr.cThu May 10 20:35:50 2012
(r235243)
+++ stable/8/sys/fs/unionfs/union_subr.cThu May 10 20:37:56 2012
(r235244)
@@ -2,8 +2,8 @@
  * Copyright (c) 1994 Jan-Simon Pendry
  * Copyright (c) 1994
  * The Regents of the University of California.  All rights reserved.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  *
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry.
@@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct
uvp = unp-un_uppervp;
dvp = unp-un_dvp;
unp-un_lowervp = unp-un_uppervp = NULLVP;
-
vp-v_vnlock = (vp-v_lock);
vp-v_data = NULL;
-   lockmgr(vp-v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp));
+   vp-v_object = NULL;
+   VI_UNLOCK(vp);
+
if (lvp != NULLVP)
-   VOP_UNLOCK(lvp, 0);
+   VOP_UNLOCK(lvp, LK_RELEASE);
if (uvp != NULLVP)
-   VOP_UNLOCK(uvp, 0);
-   vp-v_object = NULL;
+   VOP_UNLOCK(uvp, LK_RELEASE);
 
if (dvp != NULLVP  unp-un_hash.le_prev != NULL)
unionfs_rem_cached_vnode(unp, dvp);
 
+   if (lockmgr(vp-v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0)
+   panic(the lock for deletion is unacquirable.);
+
if (lvp != NULLVP) {
vfslocked = VFS_LOCK_GIANT(lvp-v_mount);
vrele(lvp);
@@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru
cn-cn_flags |= (cnp-cn_flags  SAVESTART);
 
vref(dvp);
-   VOP_UNLOCK(dvp, 0);
+   VOP_UNLOCK(dvp, LK_RELEASE);
 
if ((error = relookup(dvp, vpp, cn))) {
uma_zfree(namei_zone, cn-cn_pnbuf);
@@ -951,7 +954,7 @@ unionfs_vn_create_on_upper(struct vnode 
*vpp = vp;
 
 unionfs_vn_create_on_upper_free_out1:
-   VOP_UNLOCK(udvp, 0);
+   VOP_UNLOCK(udvp, LK_RELEASE);
 
 unionfs_vn_create_on_upper_free_out2:
if (cn.cn_flags  HASBUF) {

Modified: stable/8/sys/fs/unionfs/union_vfsops.c
==
--- stable/8/sys/fs/unionfs/union_vfsops.c  Thu May 10 20:35:50 2012
(r235243)
+++ stable/8/sys/fs/unionfs/union_vfsops.c  Thu May 10 20:37:56 2012
(r235244)
@@ -1,8 +1,8 @@
 /*-
  * Copyright (c) 1994, 1995 The Regents of the University of California.
  * Copyright (c) 1994, 1995 Jan-Simon Pendry.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  * All rights reserved.
  *
  * This code is derived from software donated to Berkeley by
@@ -166,7 +166,7 @@ unionfs_domount(struct mount *mp)
uid = va.va_uid;
gid = va.va_gid;
}
-   VOP_UNLOCK(mp-mnt_vnodecovered, 0);
+   VOP_UNLOCK(mp-mnt_vnodecovered, LK_RELEASE);
if (error)
return (error);
 
@@ -251,7 +251,7 @@ unionfs_domount(struct mount *mp)
 * Save reference
 */
if (below) {
-   VOP_UNLOCK(upperrootvp, 0);
+   VOP_UNLOCK(upperrootvp, LK_RELEASE);
vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY);
ump-um_lowervp = upperrootvp;
ump-um_uppervp = lowerrootvp;
@@ -302,7 +302,7 @@ unionfs_domount(struct mount *mp)
/*
 * Unlock the node
 */
-   VOP_UNLOCK(ump-um_uppervp, 0);
+   VOP_UNLOCK(ump-um_uppervp, LK_RELEASE);
 
/*
 * Get the unionfs root vnode.

Modified: stable/8/sys/fs/unionfs/union_vnops.c
==
--- stable/8/sys/fs/unionfs/union_vnops.c   Thu May 10 20:35:50 2012
(r235243)
+++ stable/8/sys/fs/unionfs/union_vnops.c   Thu

svn commit: r235249 - in stable/9/sys: . fs

2012-05-10 Thread Daichi GOTO
Author: daichi
Date: Thu May 10 22:36:01 2012
New Revision: 235249
URL: http://svn.freebsd.org/changeset/base/235249

Log:
  Added forgotten r234867,234944 mergeinfo

Modified:
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r235250 - stable/8/sys

2012-05-10 Thread Daichi GOTO
Author: daichi
Date: Thu May 10 22:38:15 2012
New Revision: 235250
URL: http://svn.freebsd.org/changeset/base/235250

Log:
  Added forgotten r234867,234944 mergeinfo

Modified:
Directory Properties:
  stable/8/sys/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r234944 - head/sys/fs/unionfs

2012-05-03 Thread Daichi GOTO
Author: daichi
Date: Thu May  3 07:22:29 2012
New Revision: 234944
URL: http://svn.freebsd.org/changeset/base/234944

Log:
  fixed a unionfs_readdir math issue
  
  PR:   132987
  Submitted by: Matthew Fleming mflem...@isilon.com

Modified:
  head/sys/fs/unionfs/union_vnops.c

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Thu May  3 07:17:25 2012
(r234943)
+++ head/sys/fs/unionfs/union_vnops.c   Thu May  3 07:22:29 2012
(r234944)
@@ -1642,7 +1642,7 @@ unionfs_readdir(struct vop_readdir_args 
pos = newcookies;
 
memcpy(pos, cookies_bk, ncookies_bk * sizeof(u_long));
-   pos += ncookies_bk * sizeof(u_long);
+   pos += ncookies_bk;
memcpy(pos, *(ap-a_cookies), *(ap-a_ncookies) * 
sizeof(u_long));
free(cookies_bk, M_TEMP);
free(*(ap-a_cookies), M_TEMP);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r234867 - head/sys/fs/unionfs

2012-05-01 Thread Daichi GOTO
Author: daichi
Date: Tue May  1 07:46:30 2012
New Revision: 234867
URL: http://svn.freebsd.org/changeset/base/234867

Log:
  - fixed a vnode lock hang-up issue.
  - fixed an incorrect lock status issue.
  - fixed an incorrect lock issue of unionfs root vnode removed.
(pointed out by keith)
  - fixed an infinity loop issue.
(pointed out by dumbbell)
  - changed to do LK_RELEASE expressly when unlocked.
  
  Submitted by: oz...@ongs.co.jp

Modified:
  head/sys/fs/unionfs/union_subr.c
  head/sys/fs/unionfs/union_vfsops.c
  head/sys/fs/unionfs/union_vnops.c

Modified: head/sys/fs/unionfs/union_subr.c
==
--- head/sys/fs/unionfs/union_subr.cTue May  1 07:38:40 2012
(r234866)
+++ head/sys/fs/unionfs/union_subr.cTue May  1 07:46:30 2012
(r234867)
@@ -2,8 +2,8 @@
  * Copyright (c) 1994 Jan-Simon Pendry
  * Copyright (c) 1994
  * The Regents of the University of California.  All rights reserved.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  *
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry.
@@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct
uvp = unp-un_uppervp;
dvp = unp-un_dvp;
unp-un_lowervp = unp-un_uppervp = NULLVP;
-
vp-v_vnlock = (vp-v_lock);
vp-v_data = NULL;
-   lockmgr(vp-v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp));
+   vp-v_object = NULL;
+   VI_UNLOCK(vp);
+
if (lvp != NULLVP)
-   VOP_UNLOCK(lvp, 0);
+   VOP_UNLOCK(lvp, LK_RELEASE);
if (uvp != NULLVP)
-   VOP_UNLOCK(uvp, 0);
-   vp-v_object = NULL;
+   VOP_UNLOCK(uvp, LK_RELEASE);
 
if (dvp != NULLVP  unp-un_hash.le_prev != NULL)
unionfs_rem_cached_vnode(unp, dvp);
 
+   if (lockmgr(vp-v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0)
+   panic(the lock for deletion is unacquirable.);
+
if (lvp != NULLVP) {
vfslocked = VFS_LOCK_GIANT(lvp-v_mount);
vrele(lvp);
@@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru
cn-cn_flags |= (cnp-cn_flags  SAVESTART);
 
vref(dvp);
-   VOP_UNLOCK(dvp, 0);
+   VOP_UNLOCK(dvp, LK_RELEASE);
 
if ((error = relookup(dvp, vpp, cn))) {
uma_zfree(namei_zone, cn-cn_pnbuf);
@@ -957,7 +960,7 @@ unionfs_vn_create_on_upper(struct vnode 
*vpp = vp;
 
 unionfs_vn_create_on_upper_free_out1:
-   VOP_UNLOCK(udvp, 0);
+   VOP_UNLOCK(udvp, LK_RELEASE);
 
 unionfs_vn_create_on_upper_free_out2:
if (cn.cn_flags  HASBUF) {

Modified: head/sys/fs/unionfs/union_vfsops.c
==
--- head/sys/fs/unionfs/union_vfsops.c  Tue May  1 07:38:40 2012
(r234866)
+++ head/sys/fs/unionfs/union_vfsops.c  Tue May  1 07:46:30 2012
(r234867)
@@ -1,8 +1,8 @@
 /*-
  * Copyright (c) 1994, 1995 The Regents of the University of California.
  * Copyright (c) 1994, 1995 Jan-Simon Pendry.
- * Copyright (c) 2005, 2006 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
- * Copyright (c) 2006 Daichi Goto dai...@freebsd.org
+ * Copyright (c) 2005, 2006, 2012 Masanori Ozawa oz...@ongs.co.jp, ONGS Inc.
+ * Copyright (c) 2006, 2012 Daichi Goto dai...@freebsd.org
  * All rights reserved.
  *
  * This code is derived from software donated to Berkeley by
@@ -165,7 +165,7 @@ unionfs_domount(struct mount *mp)
uid = va.va_uid;
gid = va.va_gid;
}
-   VOP_UNLOCK(mp-mnt_vnodecovered, 0);
+   VOP_UNLOCK(mp-mnt_vnodecovered, LK_RELEASE);
if (error)
return (error);
 
@@ -250,7 +250,7 @@ unionfs_domount(struct mount *mp)
 * Save reference
 */
if (below) {
-   VOP_UNLOCK(upperrootvp, 0);
+   VOP_UNLOCK(upperrootvp, LK_RELEASE);
vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY);
ump-um_lowervp = upperrootvp;
ump-um_uppervp = lowerrootvp;
@@ -281,7 +281,7 @@ unionfs_domount(struct mount *mp)
/*
 * Unlock the node
 */
-   VOP_UNLOCK(ump-um_uppervp, 0);
+   VOP_UNLOCK(ump-um_uppervp, LK_RELEASE);
 
/*
 * Get the unionfs root vnode.

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Tue May  1 07:38:40 2012
(r234866)
+++ head/sys/fs/unionfs/union_vnops.c   Tue May  1 07:46:30 2012
(r234867)
@@ -2,8 +2,8 @@
  * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
  * Copyright (c) 1992, 1993, 1994, 1995
  *  The Regents

svn commit: r219257 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan

2011-03-03 Thread Daichi GOTO
Author: daichi
Date: Fri Mar  4 07:01:45 2011
New Revision: 219257
URL: http://svn.freebsd.org/changeset/base/219257

Log:
  Add the Buffalo (Melco Inc.) WLI-UC-G301N
  
  PR:   usb/155229
  Submitted by: Yoshiaki UCHIKAWA
  MFC after:1 week

Modified:
  head/share/man/man4/run.4
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_run.c

Modified: head/share/man/man4/run.4
==
--- head/share/man/man4/run.4   Thu Mar  3 22:34:13 2011(r219256)
+++ head/share/man/man4/run.4   Fri Mar  4 07:01:45 2011(r219257)
@@ -120,6 +120,7 @@ driver supports the following wireless a
 .It Belkin F6D4050 ver 1
 .It Buffalo WLI-UC-AG300N
 .It Buffalo WLI-UC-G300N
+.It Buffalo WLI-UC-G301N
 .It Buffalo WLI-UC-GN
 .It Corega CG-WLUSB2GNL
 .It Corega CG-WLUSB2GNR

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Mar  3 22:34:13 2011(r219256)
+++ head/sys/dev/usb/usbdevsFri Mar  4 07:01:45 2011(r219257)
@@ -2157,6 +2157,7 @@ product MELCO WLIUCG  0x0137  WLI-UC-G
 product MELCO RT2870_1 0x0148  RT2870
 product MELCO RT2870_2 0x0150  RT2870
 product MELCO WLIUCGN  0x015d  WLI-UC-GN
+product MELCO WLIUCG301N   0x016f  WLI-UC-G301N
 
 /* Merlin products */
 product MERLIN V620 0x1110  Merlin V620

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Thu Mar  3 22:34:13 2011
(r219256)
+++ head/sys/dev/usb/wlan/if_run.c  Fri Mar  4 07:01:45 2011
(r219257)
@@ -210,6 +210,7 @@ static const struct usb_device_id run_de
 RUN_DEV(MELCO, RT2870_2),
 RUN_DEV(MELCO, WLIUCAG300N),
 RUN_DEV(MELCO, WLIUCG300N),
+RUN_DEV(MELCO, WLIUCG301N),
 RUN_DEV(MELCO, WLIUCGN),
 RUN_DEV(MOTOROLA4, RT2770),
 RUN_DEV(MOTOROLA4, RT3070),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r212221 - in head: sbin/mount_unionfs sys/fs/unionfs

2010-09-04 Thread Daichi GOTO
Author: daichi
Date: Sun Sep  5 04:58:16 2010
New Revision: 212221
URL: http://svn.freebsd.org/changeset/base/212221

Log:
  Allowed unionfs to use whiteout not supporting file system as
  upper layer. Until now, unionfs prevents to use that kind of
  file system as upper layer. This time, I changed to allow
  that kind of file system as upper layer. By this change, you
  can use whiteout not supporting file system (e.g., especially
  for tmpfs) as upper layer. It's very useful for combination of
  tmpfs as upper layer and read only file system as lower layer.
  
  By difinition, without whiteout support from the file system
  backing the upper layer, there is no way that delete and rename
  operations on lower layer objects can be done.  EOPNOTSUPP is
  returned for this kind of operations as generated by VOP_WHITEOUT()
  along with any others which would make modifica tions to the
  lower layer, such as chmod(1).
  
  This change is suggested by ed.
  
  Submitted by: ed

Modified:
  head/sbin/mount_unionfs/mount_unionfs.8
  head/sys/fs/unionfs/union_vfsops.c

Modified: head/sbin/mount_unionfs/mount_unionfs.8
==
--- head/sbin/mount_unionfs/mount_unionfs.8 Sun Sep  5 03:05:03 2010
(r212220)
+++ head/sbin/mount_unionfs/mount_unionfs.8 Sun Sep  5 04:58:16 2010
(r212221)
@@ -363,9 +363,10 @@ their intent to take it over.
 Without whiteout support from the file system backing the upper layer,
 there is no way that delete and rename operations on lower layer
 objects can be done.
-.Er EROFS
-is returned for this kind of operations along with any others
-which would make modifications to the lower layer, such as
+.Er EOPNOTSUPP
+is returned for this kind of operations as generated by VOP_WHITEOUT()
+along with any others which would make modifications to the lower 
+layer, such as
 .Xr chmod 1 .
 .Pp
 Running

Modified: head/sys/fs/unionfs/union_vfsops.c
==
--- head/sys/fs/unionfs/union_vfsops.c  Sun Sep  5 03:05:03 2010
(r212220)
+++ head/sys/fs/unionfs/union_vfsops.c  Sun Sep  5 04:58:16 2010
(r212221)
@@ -89,7 +89,6 @@ unionfs_domount(struct mount *mp)
u_short ufile;
unionfs_copymode copymode;
unionfs_whitemode whitemode;
-   struct componentname fakecn;
struct nameidata nd, *ndp;
struct vattrva;
 
@@ -280,26 +279,6 @@ unionfs_domount(struct mount *mp)
mp-mnt_flag |= ump-um_uppervp-v_mount-mnt_flag  MNT_RDONLY;
 
/*
-* Check whiteout
-*/
-   if ((mp-mnt_flag  MNT_RDONLY) == 0) {
-   memset(fakecn, 0, sizeof(fakecn));
-   fakecn.cn_nameiop = LOOKUP;
-   fakecn.cn_thread = td;
-   error = VOP_WHITEOUT(ump-um_uppervp, fakecn, LOOKUP);
-   if (error) {
-   if (below) {
-   VOP_UNLOCK(ump-um_uppervp, 0);
-   vrele(upperrootvp);
-   } else
-   vput(ump-um_uppervp);
-   free(ump, M_UNIONFSMNT);
-   mp-mnt_data = NULL;
-   return (error);
-   }
-   }
-
-   /*
 * Unlock the node
 */
VOP_UNLOCK(ump-um_uppervp, 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r212222 - head/etc/rc.d

2010-09-04 Thread Daichi GOTO
Author: daichi
Date: Sun Sep  5 05:44:40 2010
New Revision: 21
URL: http://svn.freebsd.org/changeset/base/21

Log:
  Avoid to try to remove suj journal file (.sujournal) and conventional
  snapshot directory (.snap) from cleartmp rc.d script.

Modified:
  head/etc/rc.d/cleartmp

Modified: head/etc/rc.d/cleartmp
==
--- head/etc/rc.d/cleartmp  Sun Sep  5 04:58:16 2010(r212221)
+++ head/etc/rc.d/cleartmp  Sun Sep  5 05:44:40 2010(r21)
@@ -36,7 +36,10 @@ cleartmp_start()
#   it can prevent foot-shooting in future.
# + /tmp/lost+found is preserved, but its contents are removed.
# + lost+found and quota.* in subdirectories are removed.
+   # + .sujournal and .snap are preserved.
find -x ${tmp}/. ! -name . \
+   ! \( -name .sujournal -type f -user root \) \
+   ! \( -name .snap -type d -user root \) \
! \( -name lost+found -type d -user root \) \
! \( \( -name quota.user -or -name quota.group \) \
-type f -user root \) \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r186110 - stable/7/sys/fs/unionfs

2008-12-14 Thread Daichi GOTO
Author: daichi
Date: Mon Dec 15 03:56:54 2008
New Revision: 186110
URL: http://svn.freebsd.org/changeset/base/186110

Log:
  MFC r185284, r185283
  
  PR:   118346
  Submitted by: Masanori OZAWA oz...@ongs.co.jp, trasz
  Discussed at: devsummit Strassburg, EuroBSDCon2008
  Discussed with:   rwatson, gnn, hrs
  Approved by:  re (gnn)

Modified:
  stable/7/sys/fs/unionfs/union.h
  stable/7/sys/fs/unionfs/union_subr.c
  stable/7/sys/fs/unionfs/union_vfsops.c
  stable/7/sys/fs/unionfs/union_vnops.c

Modified: stable/7/sys/fs/unionfs/union.h
==
--- stable/7/sys/fs/unionfs/union.h Mon Dec 15 02:06:02 2008
(r186109)
+++ stable/7/sys/fs/unionfs/union.h Mon Dec 15 03:56:54 2008
(r186110)
@@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru
 int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, 
struct vattr *uva, struct ucred *cred, struct thread *td);
 int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct 
unionfs_node *unp, struct componentname *cnp, struct thread *td);
 int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct 
thread *td, char *path);
+int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct 
componentname *cnp, struct componentname *cn, struct thread *td, char *path, 
int pathlen, u_long nameiop);
 int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);

Modified: stable/7/sys/fs/unionfs/union_subr.c
==
--- stable/7/sys/fs/unionfs/union_subr.cMon Dec 15 02:06:02 2008
(r186109)
+++ stable/7/sys/fs/unionfs/union_subr.cMon Dec 15 03:56:54 2008
(r186110)
@@ -103,10 +103,10 @@ unionfs_get_hashhead(struct vnode *dvp, 
 }
 
 /*
- * Get the cached vnode. (only VDIR)
+ * Get the cached vnode.
  */
 static struct vnode *
-unionfs_get_cached_vdir(struct vnode *uvp, struct vnode *lvp,
+unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp,
struct vnode *dvp, char *path)
 {
struct unionfs_node_hashhead *hd;
@@ -114,9 +114,9 @@ unionfs_get_cached_vdir(struct vnode *uv
struct vnode   *vp;
 
KASSERT((uvp == NULLVP || uvp-v_type == VDIR),
-   (unionfs_get_cached_vdir: v_type != VDIR));
+   (unionfs_get_cached_vnode: v_type != VDIR));
KASSERT((lvp == NULLVP || lvp-v_type == VDIR),
-   (unionfs_get_cached_vdir: v_type != VDIR));
+   (unionfs_get_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -140,10 +140,10 @@ unionfs_get_cached_vdir(struct vnode *uv
 }
 
 /*
- * Add the new vnode into cache. (only VDIR)
+ * Add the new vnode into cache.
  */
 static struct vnode *
-unionfs_ins_cached_vdir(struct unionfs_node *uncp,
+unionfs_ins_cached_vnode(struct unionfs_node *uncp,
struct vnode *dvp, char *path)
 {
struct unionfs_node_hashhead *hd;
@@ -151,9 +151,9 @@ unionfs_ins_cached_vdir(struct unionfs_n
struct vnode   *vp;
 
KASSERT((uncp-un_uppervp==NULLVP || uncp-un_uppervp-v_type==VDIR),
-   (unionfs_ins_cached_vdir: v_type != VDIR));
+   (unionfs_ins_cached_vnode: v_type != VDIR));
KASSERT((uncp-un_lowervp==NULLVP || uncp-un_lowervp-v_type==VDIR),
-   (unionfs_ins_cached_vdir: v_type != VDIR));
+   (unionfs_ins_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -180,16 +180,16 @@ unionfs_ins_cached_vdir(struct unionfs_n
 }
 
 /*
- * Remove the vnode. (only VDIR)
+ * Remove the vnode.
  */
 static void
-unionfs_rem_cached_vdir(struct unionfs_node *unp, struct vnode *dvp)
+unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp)
 {
-   KASSERT((unp != NULL), (unionfs_rem_cached_vdir: null node));
+   KASSERT((unp != NULL), (unionfs_rem_cached_vnode: null node));
KASSERT((dvp != NULLVP),
-   (unionfs_rem_cached_vdir: null parent vnode));
+   (unionfs_rem_cached_vnode: null parent vnode));
KASSERT((unp-un_hash.le_prev != NULL),
-   (unionfs_rem_cached_vdir: null hash));
+   (unionfs_rem_cached_vnode: null hash));
 
VI_LOCK(dvp);
LIST_REMOVE(unp, un_hash);
@@ -233,9 +233,9 @@ unionfs_nodeget(struct mount *mp, struct
if (cnp  !(cnp-cn_flags  ISLASTCN))
path = NULL;
 
-   /* check the vdir cache */
+   /* check the cache */
if (path != NULL  dvp != NULLVP  vt == VDIR) {
-   vp = unionfs_get_cached_vdir(uppervp, lowervp, dvp, path);
+   

svn commit: r186111 - releng/7.1/sys/fs/unionfs

2008-12-14 Thread Daichi GOTO
Author: daichi
Date: Mon Dec 15 03:58:55 2008
New Revision: 186111
URL: http://svn.freebsd.org/changeset/base/186111

Log:
  MFC r185284, r185283
  
  PR: 118346
  Submitted by:   Masanori OZAWA oz...@ongs.co.jp, trasz
  Discussed at:   devsummit Strassburg, EuroBSDCon2008
  Discussed with: rwatson, gnn, hrs
  Approved by:re (gnn)

Modified:
  releng/7.1/sys/fs/unionfs/union.h
  releng/7.1/sys/fs/unionfs/union_subr.c
  releng/7.1/sys/fs/unionfs/union_vfsops.c
  releng/7.1/sys/fs/unionfs/union_vnops.c

Modified: releng/7.1/sys/fs/unionfs/union.h
==
--- releng/7.1/sys/fs/unionfs/union.h   Mon Dec 15 03:56:54 2008
(r186110)
+++ releng/7.1/sys/fs/unionfs/union.h   Mon Dec 15 03:58:55 2008
(r186111)
@@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru
 int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, 
struct vattr *uva, struct ucred *cred, struct thread *td);
 int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct 
unionfs_node *unp, struct componentname *cnp, struct thread *td);
 int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct 
thread *td, char *path);
+int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct 
componentname *cnp, struct componentname *cn, struct thread *td, char *path, 
int pathlen, u_long nameiop);
 int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);

Modified: releng/7.1/sys/fs/unionfs/union_subr.c
==
--- releng/7.1/sys/fs/unionfs/union_subr.c  Mon Dec 15 03:56:54 2008
(r186110)
+++ releng/7.1/sys/fs/unionfs/union_subr.c  Mon Dec 15 03:58:55 2008
(r186111)
@@ -103,10 +103,10 @@ unionfs_get_hashhead(struct vnode *dvp, 
 }
 
 /*
- * Get the cached vnode. (only VDIR)
+ * Get the cached vnode.
  */
 static struct vnode *
-unionfs_get_cached_vdir(struct vnode *uvp, struct vnode *lvp,
+unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp,
struct vnode *dvp, char *path)
 {
struct unionfs_node_hashhead *hd;
@@ -114,9 +114,9 @@ unionfs_get_cached_vdir(struct vnode *uv
struct vnode   *vp;
 
KASSERT((uvp == NULLVP || uvp-v_type == VDIR),
-   (unionfs_get_cached_vdir: v_type != VDIR));
+   (unionfs_get_cached_vnode: v_type != VDIR));
KASSERT((lvp == NULLVP || lvp-v_type == VDIR),
-   (unionfs_get_cached_vdir: v_type != VDIR));
+   (unionfs_get_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -140,10 +140,10 @@ unionfs_get_cached_vdir(struct vnode *uv
 }
 
 /*
- * Add the new vnode into cache. (only VDIR)
+ * Add the new vnode into cache.
  */
 static struct vnode *
-unionfs_ins_cached_vdir(struct unionfs_node *uncp,
+unionfs_ins_cached_vnode(struct unionfs_node *uncp,
struct vnode *dvp, char *path)
 {
struct unionfs_node_hashhead *hd;
@@ -151,9 +151,9 @@ unionfs_ins_cached_vdir(struct unionfs_n
struct vnode   *vp;
 
KASSERT((uncp-un_uppervp==NULLVP || uncp-un_uppervp-v_type==VDIR),
-   (unionfs_ins_cached_vdir: v_type != VDIR));
+   (unionfs_ins_cached_vnode: v_type != VDIR));
KASSERT((uncp-un_lowervp==NULLVP || uncp-un_lowervp-v_type==VDIR),
-   (unionfs_ins_cached_vdir: v_type != VDIR));
+   (unionfs_ins_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -180,16 +180,16 @@ unionfs_ins_cached_vdir(struct unionfs_n
 }
 
 /*
- * Remove the vnode. (only VDIR)
+ * Remove the vnode.
  */
 static void
-unionfs_rem_cached_vdir(struct unionfs_node *unp, struct vnode *dvp)
+unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp)
 {
-   KASSERT((unp != NULL), (unionfs_rem_cached_vdir: null node));
+   KASSERT((unp != NULL), (unionfs_rem_cached_vnode: null node));
KASSERT((dvp != NULLVP),
-   (unionfs_rem_cached_vdir: null parent vnode));
+   (unionfs_rem_cached_vnode: null parent vnode));
KASSERT((unp-un_hash.le_prev != NULL),
-   (unionfs_rem_cached_vdir: null hash));
+   (unionfs_rem_cached_vnode: null hash));
 
VI_LOCK(dvp);
LIST_REMOVE(unp, un_hash);
@@ -233,9 +233,9 @@ unionfs_nodeget(struct mount *mp, struct
if (cnp  !(cnp-cn_flags  ISLASTCN))
path = NULL;
 
-   /* check the vdir cache */
+   /* check the cache */
if (path != NULL  dvp != NULLVP  vt == VDIR) {
-   vp = unionfs_get_cached_vdir(uppervp, lowervp, dvp, path);
+  

svn commit: r185283 - head/sys/fs/unionfs

2008-11-24 Thread Daichi GOTO
Author: daichi
Date: Tue Nov 25 03:18:35 2008
New Revision: 185283
URL: http://svn.freebsd.org/changeset/base/185283

Log:
  Fixes Unionfs socket issue reported as kern/118346.
  
  PR:   118346
  Submitted by: Masanori OZAWA [EMAIL PROTECTED]
  Discussed at: devsummit Strassburg, EuroBSDCon2008
  Discussed with:   rwatson, gnn, hrs
  MFC after:2 week

Modified:
  head/sys/fs/unionfs/union.h
  head/sys/fs/unionfs/union_subr.c
  head/sys/fs/unionfs/union_vnops.c

Modified: head/sys/fs/unionfs/union.h
==
--- head/sys/fs/unionfs/union.h Tue Nov 25 03:04:51 2008(r185282)
+++ head/sys/fs/unionfs/union.h Tue Nov 25 03:18:35 2008(r185283)
@@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru
 int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, 
struct vattr *uva, struct ucred *cred, struct thread *td);
 int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct 
unionfs_node *unp, struct componentname *cnp, struct thread *td);
 int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct 
thread *td, char *path);
+int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct 
componentname *cnp, struct componentname *cn, struct thread *td, char *path, 
int pathlen, u_long nameiop);
 int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);
 int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, 
struct thread *td);

Modified: head/sys/fs/unionfs/union_subr.c
==
--- head/sys/fs/unionfs/union_subr.cTue Nov 25 03:04:51 2008
(r185282)
+++ head/sys/fs/unionfs/union_subr.cTue Nov 25 03:18:35 2008
(r185283)
@@ -113,10 +113,10 @@ unionfs_get_cached_vnode(struct vnode *u
struct unionfs_node *unp;
struct vnode   *vp;
 
-   KASSERT((uvp == NULLVP || uvp-v_type == VDIR || uvp-v_type == VSOCK),
-   (unionfs_get_cached_vnode: v_type != VDIR/VSOCK));
-   KASSERT((lvp == NULLVP || lvp-v_type == VDIR || lvp-v_type == VSOCK),
-   (unionfs_get_cached_vnode: v_type != VDIR/VSOCK));
+   KASSERT((uvp == NULLVP || uvp-v_type == VDIR),
+   (unionfs_get_cached_vnode: v_type != VDIR));
+   KASSERT((lvp == NULLVP || lvp-v_type == VDIR),
+   (unionfs_get_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -150,12 +150,10 @@ unionfs_ins_cached_vnode(struct unionfs_
struct unionfs_node *unp;
struct vnode   *vp;
 
-   KASSERT((uncp-un_uppervp==NULLVP || uncp-un_uppervp-v_type==VDIR ||
-   uncp-un_uppervp-v_type==VSOCK),
-   (unionfs_ins_cached_vnode: v_type != VDIR/VSOCK));
-   KASSERT((uncp-un_lowervp==NULLVP || uncp-un_lowervp-v_type==VDIR ||
-   uncp-un_lowervp-v_type==VSOCK),
-   (unionfs_ins_cached_vnode: v_type != VDIR/VSOCK));
+   KASSERT((uncp-un_uppervp==NULLVP || uncp-un_uppervp-v_type==VDIR),
+   (unionfs_ins_cached_vnode: v_type != VDIR));
+   KASSERT((uncp-un_lowervp==NULLVP || uncp-un_lowervp-v_type==VDIR),
+   (unionfs_ins_cached_vnode: v_type != VDIR));
 
VI_LOCK(dvp);
hd = unionfs_get_hashhead(dvp, path);
@@ -236,7 +234,7 @@ unionfs_nodeget(struct mount *mp, struct
path = NULL;
 
/* check the cache */
-   if (path != NULL  dvp != NULLVP  (vt == VDIR || vt == VSOCK)) {
+   if (path != NULL  dvp != NULLVP  vt == VDIR) {
vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp, path);
if (vp != NULLVP) {
vref(vp);
@@ -277,20 +275,9 @@ unionfs_nodeget(struct mount *mp, struct
if (lowervp != NULLVP)
vref(lowervp);
 
-   switch (vt) {
-   case VDIR:
+   if (vt == VDIR)
unp-un_hashtbl = hashinit(NUNIONFSNODECACHE, M_UNIONFSHASH,
(unp-un_hashmask));
-   break;
-   case VSOCK:
-   if (uppervp != NULLVP)
-   vp-v_socket = uppervp-v_socket;
-   else
-   vp-v_socket = lowervp-v_socket;
-   break;
-   default:
-   break;
-   }
 
unp-un_vnode = vp;
unp-un_uppervp = uppervp;
@@ -314,7 +301,7 @@ unionfs_nodeget(struct mount *mp, struct
(lowervp != NULLVP  ump-um_lowervp == lowervp))
vp-v_vflag |= VV_ROOT;
 
-   if (path != NULL  dvp != NULLVP  (vt == VDIR || vt == VSOCK))
+   if (path != NULL  dvp != NULLVP  vt == VDIR)
*vpp = unionfs_ins_cached_vnode(unp, dvp, path);
if ((*vpp) != NULLVP) {
if (dvp != NULLVP)
@@ -540,7 +527,7 @@