src/filed/fd_snapshot.c
int scan_subvolumes(fs_device *vol, alist *lst) {
      int ret = 0;
      arg_parser cmd;
      uint32_t   dev=0;
      char      *mp=NULL, *fstype=NULL, *device=Device;

      reset();
      set_device(vol->device);
      set_mountpoint(vol->mountpoint);
      set_fstype(vol->fstype);

      if (!do_command("subvolumes", &cmd)) {
         goto bail_out;
      }

      for (int i = 0; i < cmd.argc ; i++) {
         if (strcasecmp(cmd.argk[i], "Dev") == 0 && cmd.argv[i]) {
            dev = str_to_int64(cmd.argv[i]);

         } else if (strcasecmp(cmd.argk[i], "MountPoint") == 0 && cmd.argv[i]) {
            mp = cmd.argv[i];

         } else if (strcasecmp(cmd.argk[i], "Device") == 0 && cmd.argv[i]) {
            device = cmd.argv[i];

         } else if (strcasecmp(cmd.argk[i], "FSType") == 0 && cmd.argv[i]) {
            fstype = cmd.argv[i];
            if (mp && fstype && dev) {
               fs_device *elt = New(fs_device(dev, device, mp, fstype));
               lst->append(elt);
               /* reset variables */
            }
            dev = 0;
            mp  = fstype = NULL;
            device = Device;
         }
      }
      ret = 1;

   bail_out:
      return ret;
   }
/* Scan sub volumes for a particular volume */
Scan sub volumes for a particular volume
Scan sub volumes for a particular volume
int scan_subvolumes(fs_device *vol, alist *lst) {
      int ret = 0;
      arg_parser cmd;
      uint32_t   dev=0;
      char      *mp=NULL, *fstype=NULL, *device=Device;
      reset();
      set_device(vol->device);
      set_mountpoint(vol->mountpoint);
      set_fstype(vol->fstype);
      if (!do_command("subvolumes", &cmd)) {
         goto bail_out;
      }
      for (int i = 0; i < cmd.argc ; i++) {
         if (strcasecmp(cmd.argk[i], "Dev") == 0 && cmd.argv[i]) {
            dev = str_to_int64(cmd.argv[i]);
         } else if (strcasecmp(cmd.argk[i], "MountPoint") == 0 && cmd.argv[i]) {
            mp = cmd.argv[i];
         } else if (strcasecmp(cmd.argk[i], "Device") == 0 && cmd.argv[i]) {
            device = cmd.argv[i];
         } else if (strcasecmp(cmd.argk[i], "FSType") == 0 && cmd.argv[i]) {
            fstype = cmd.argv[i];
            if (mp && fstype && dev) {
               fs_device *elt = New(fs_device(dev, device, mp, fstype));
               lst->append(elt);
            }
            dev = 0;
            mp  = fstype = NULL;
            device = Device;
         }
      }
      ret = 1;
   bail_out:
      return ret;
   }
int scan_subvolumes ( fs_device * vol , alist * lst ) { int ret = 0 ; arg_parser cmd ; uint32_t dev = 0 ; char * mp = NULL , * fstype = NULL , * device = Device ; reset ( ) ; set_device ( vol -> device ) ; set_mountpoint ( vol -> mountpoint ) ; set_fstype ( vol -> fstype ) ; if ( ! do_command ( " " , & cmd ) ) { goto bail_out ; } for ( int i = 0 ; i < cmd . argc ; i ++ ) { if ( strcasecmp ( cmd . argk [ i ] , " " ) == 0 && cmd . argv [ i ] ) { dev = str_to_int64 ( cmd . argv [ i ] ) ; } else if ( strcasecmp ( cmd . argk [ i ] , " " ) == 0 && cmd . argv [ i ] ) { mp = cmd . argv [ i ] ; } else if ( strcasecmp ( cmd . argk [ i ] , " " ) == 0 && cmd . argv [ i ] ) { device = cmd . argv [ i ] ; } else if ( strcasecmp ( cmd . argk [ i ] , " " ) == 0 && cmd . argv [ i ] ) { fstype = cmd . argv [ i ] ; if ( mp && fstype && dev ) { fs_device * elt = New ( fs_device ( dev , device , mp , fstype ) ) ; lst -> append ( elt ) ; } dev = 0 ; mp = fstype = NULL ; device = Device ; } } ret = 1 ; bail_out : return ret ; }
Scan sub volumes for a particular volume
Scan sub volumes for a particular volume
/* reset variables */