Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/kinit/name_to_dev.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC revision 815 by niro, Fri Apr 24 18:32:46 2009 UTC
# Line 20  static dev_t try_name(char *name, int pa Line 20  static dev_t try_name(char *name, int pa
20   char path[BUF_SZ];   char path[BUF_SZ];
21   char buf[BUF_SZ];   char buf[BUF_SZ];
22   int range;   int range;
23   unsigned int major, minor;   unsigned int major_num, minor_num;
24   dev_t res;   dev_t res;
25   char *s;   char *s;
26   int len;   int len;
# Line 37  static dev_t try_name(char *name, int pa Line 37  static dev_t try_name(char *name, int pa
37   if (len <= 0 || len == BUF_SZ || buf[len - 1] != '\n')   if (len <= 0 || len == BUF_SZ || buf[len - 1] != '\n')
38   goto fail;   goto fail;
39   buf[len - 1] = '\0';   buf[len - 1] = '\0';
40   major = strtoul(buf, &s, 10);   major_num = strtoul(buf, &s, 10);
41   if (*s != ':')   if (*s != ':')
42   goto fail;   goto fail;
43   minor = strtoul(s + 1, &s, 10);   minor_num = strtoul(s + 1, &s, 10);
44   if (*s)   if (*s)
45   goto fail;   goto fail;
46   res = makedev(major, minor);   res = makedev(major_num, minor_num);
47    
48   /* if it's there and we are not looking for a partition - that's it */   /* if it's there and we are not looking for a partition - that's it */
49   if (!part)   if (!part)
# Line 105  static inline dev_t name_to_dev_t_real(c Line 105  static inline dev_t name_to_dev_t_real(c
105   int len;   int len;
106   const char *devname;   const char *devname;
107   char *cptr, *e1, *e2;   char *cptr, *e1, *e2;
108   int major, minor;   int major_num, minor_num;
109    
110    
111   if (name[0] == '/') {   if (name[0] == '/') {
# Line 124  static inline dev_t name_to_dev_t_real(c Line 124  static inline dev_t name_to_dev_t_real(c
124      cptr[1] != '\0') {      cptr[1] != '\0') {
125   /* Colon-separated decimal device number */   /* Colon-separated decimal device number */
126   *cptr = '\0';   *cptr = '\0';
127   major = strtoul(devname+5, &e1, 10);   major_num = strtoul(devname+5, &e1, 10);
128   minor = strtoul(cptr+1, &e2, 10);   minor_num = strtoul(cptr+1, &e2, 10);
129   if (!*e1 && !*e2)   if (!*e1 && !*e2)
130   return makedev(major, minor);   return makedev(major_num, minor_num);
131   *cptr = ':';   *cptr = ':';
132   } else {   } else {
133   /* Hexadecimal device number */   /* Hexadecimal device number */

Legend:
Removed from v.532  
changed lines
  Added in v.815