libzfs_iter.c (307108) | libzfs_iter.c (331394) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 303 unchanged lines hidden (view full) --- 312 zfs_iter_f ssa_func; 313 void *ssa_arg; 314} snapspec_arg_t; 315 316static int 317snapspec_cb(zfs_handle_t *zhp, void *arg) 318{ 319 snapspec_arg_t *ssa = arg; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 303 unchanged lines hidden (view full) --- 312 zfs_iter_f ssa_func; 313 void *ssa_arg; 314} snapspec_arg_t; 315 316static int 317snapspec_cb(zfs_handle_t *zhp, void *arg) 318{ 319 snapspec_arg_t *ssa = arg; |
320 char *shortsnapname; | 320 const char *shortsnapname; |
321 int err = 0; 322 323 if (ssa->ssa_seenlast) 324 return (0); | 321 int err = 0; 322 323 if (ssa->ssa_seenlast) 324 return (0); |
325 shortsnapname = zfs_strdup(zhp->zfs_hdl, 326 strchr(zfs_get_name(zhp), '@') + 1); | |
327 | 325 |
326 shortsnapname = strchr(zfs_get_name(zhp), '@') + 1; |
|
328 if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) 329 ssa->ssa_seenfirst = B_TRUE; | 327 if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) 328 ssa->ssa_seenfirst = B_TRUE; |
329 if (strcmp(shortsnapname, ssa->ssa_last) == 0) 330 ssa->ssa_seenlast = B_TRUE; |
|
330 331 if (ssa->ssa_seenfirst) { 332 err = ssa->ssa_func(zhp, ssa->ssa_arg); 333 } else { 334 zfs_close(zhp); 335 } 336 | 331 332 if (ssa->ssa_seenfirst) { 333 err = ssa->ssa_func(zhp, ssa->ssa_arg); 334 } else { 335 zfs_close(zhp); 336 } 337 |
337 if (strcmp(shortsnapname, ssa->ssa_last) == 0) 338 ssa->ssa_seenlast = B_TRUE; 339 free(shortsnapname); 340 | |
341 return (err); 342} 343 344/* 345 * spec is a string like "A,B%C,D" 346 * 347 * <snaps>, where <snaps> can be: 348 * <snap> (single snapshot) --- 178 unchanged lines hidden --- | 338 return (err); 339} 340 341/* 342 * spec is a string like "A,B%C,D" 343 * 344 * <snaps>, where <snaps> can be: 345 * <snap> (single snapshot) --- 178 unchanged lines hidden --- |