/[hurd]/hurd/libstore/nbd.c
ViewVC logotype

Diff of /hurd/libstore/nbd.c

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

revision 1.6 by roland, Sat Oct 6 18:33:51 2001 UTC revision 1.7 by roland, Sun Dec 23 07:34:55 2001 UTC
# Line 191  nbd_open (const char *name, int flags, Line 191  nbd_open (const char *name, int flags,
191    return store_nbd_open (name, flags, store);    return store_nbd_open (name, flags, store);
192  }  }
193    
194  /* Valid name syntax is HOSTNAME:PORT[/BLOCKSIZE].  static const char url_prefix[] = "nbd://";
195    
196    /* Valid name syntax is [nbd://]HOSTNAME:PORT[/BLOCKSIZE].
197     If "/BLOCKSIZE" is omitted, the block size is 1.  */     If "/BLOCKSIZE" is omitted, the block size is 1.  */
198  static error_t  static error_t
199  nbd_validate_name (const char *name,  nbd_validate_name (const char *name,
200                     const struct store_class *const *classes)                     const struct store_class *const *classes)
201  {  {
202    char *p = strchr (name, ':'), *endp;    char *p, *endp;
203    
204      if (!strncmp (name, url_prefix, sizeof url_prefix - 1))
205        name += sizeof url_prefix - 1;
206    
207      p = strchr (name, ':');
208    if (p == 0)    if (p == 0)
209      return EINVAL;      return EINVAL;
210    endp = 0;    endp = 0;
# Line 231  nbdopen (const char *name, int *mod_flag Line 238  nbdopen (const char *name, int *mod_flag
238    char **ap;    char **ap;
239    struct nbd_startup ns;    struct nbd_startup ns;
240    ssize_t cc;    ssize_t cc;
241      unsigned long int port;
242      char *hostname, *p, *endp;
243    
244      if (!strncmp (name, url_prefix, sizeof url_prefix - 1))
245        name += sizeof url_prefix - 1;
246    
247    /* First we have to parse the store name to get the host name and TCP    /* First we have to parse the store name to get the host name and TCP
248       port number to connect to and the block size to use.  */       port number to connect to and the block size to use.  */
249    
250    unsigned long int port;    hostname = strdupa (name);
251    char *hostname = strdupa (name);    p = strchr (hostname, ':');
   char *p = strchr (hostname, ':'), *endp;  
252    
253    if (p == 0)    if (p == 0)
254      return EINVAL;      return EINVAL;
# Line 357  nbd_clear_flags (struct store *store, in Line 368  nbd_clear_flags (struct store *store, in
368    return err;    return err;
369  }  }
370    
371  const struct store_class  const struct store_class store_nbd_class =
 store_nbd_class =  
372  {  {
373    STORAGE_NETWORK, "nbd",    STORAGE_NETWORK, "nbd",
374    open: nbd_open,    open: nbd_open,

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26