autofs_vnops.c (332596) | autofs_vnops.c (341074) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2014 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * This software was developed by Edward Tomasz Napierala under sponsorship 8 * from the FreeBSD Foundation. --- 17 unchanged lines hidden (view full) --- 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2014 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * This software was developed by Edward Tomasz Napierala under sponsorship 8 * from the FreeBSD Foundation. --- 17 unchanged lines hidden (view full) --- 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: stable/11/sys/fs/autofs/autofs_vnops.c 332596 2018-04-16 16:15:31Z trasz $"); | 34__FBSDID("$FreeBSD: stable/11/sys/fs/autofs/autofs_vnops.c 341074 2018-11-27 16:51:18Z markj $"); |
35 36#include <sys/param.h> | 35 36#include <sys/param.h> |
37#include <sys/systm.h> |
|
37#include <sys/kernel.h> 38#include <sys/condvar.h> 39#include <sys/dirent.h> 40#include <sys/fcntl.h> 41#include <sys/lock.h> 42#include <sys/mount.h> 43#include <sys/mutex.h> 44#include <sys/namei.h> 45#include <sys/signalvar.h> 46#include <sys/stat.h> | 38#include <sys/kernel.h> 39#include <sys/condvar.h> 40#include <sys/dirent.h> 41#include <sys/fcntl.h> 42#include <sys/lock.h> 43#include <sys/mount.h> 44#include <sys/mutex.h> 45#include <sys/namei.h> 46#include <sys/signalvar.h> 47#include <sys/stat.h> |
47#include <sys/systm.h> | |
48#include <sys/taskqueue.h> 49#include <sys/tree.h> 50#include <sys/vnode.h> 51#include <machine/atomic.h> 52#include <vm/uma.h> 53 54#include <fs/autofs/autofs.h> 55 --- 300 unchanged lines hidden (view full) --- 356 struct dirent dirent; 357 size_t namlen, padded_namlen, reclen; 358 int error; 359 360 namlen = strlen(name); 361 padded_namlen = roundup2(namlen + 1, __alignof(struct dirent)); 362 KASSERT(padded_namlen <= MAXNAMLEN, ("%zd > MAXNAMLEN", padded_namlen)); 363 reclen = offsetof(struct dirent, d_name) + padded_namlen; | 48#include <sys/taskqueue.h> 49#include <sys/tree.h> 50#include <sys/vnode.h> 51#include <machine/atomic.h> 52#include <vm/uma.h> 53 54#include <fs/autofs/autofs.h> 55 --- 300 unchanged lines hidden (view full) --- 356 struct dirent dirent; 357 size_t namlen, padded_namlen, reclen; 358 int error; 359 360 namlen = strlen(name); 361 padded_namlen = roundup2(namlen + 1, __alignof(struct dirent)); 362 KASSERT(padded_namlen <= MAXNAMLEN, ("%zd > MAXNAMLEN", padded_namlen)); 363 reclen = offsetof(struct dirent, d_name) + padded_namlen; |
364 | |
365 if (reclenp != NULL) 366 *reclenp = reclen; 367 368 if (uio == NULL) 369 return (0); 370 371 if (uio->uio_resid < reclen) 372 return (EINVAL); 373 374 dirent.d_fileno = fileno; 375 dirent.d_reclen = reclen; 376 dirent.d_type = DT_DIR; 377 dirent.d_namlen = namlen; 378 memcpy(dirent.d_name, name, namlen); | 364 if (reclenp != NULL) 365 *reclenp = reclen; 366 367 if (uio == NULL) 368 return (0); 369 370 if (uio->uio_resid < reclen) 371 return (EINVAL); 372 373 dirent.d_fileno = fileno; 374 dirent.d_reclen = reclen; 375 dirent.d_type = DT_DIR; 376 dirent.d_namlen = namlen; 377 memcpy(dirent.d_name, name, namlen); |
379 memset(dirent.d_name + namlen, 0, padded_namlen - namlen); | 378 dirent_terminate(&dirent); |
380 error = uiomove(&dirent, reclen, uio); 381 382 return (error); 383} 384 385static size_t 386autofs_dirent_reclen(const char *name) 387{ --- 330 unchanged lines hidden --- | 379 error = uiomove(&dirent, reclen, uio); 380 381 return (error); 382} 383 384static size_t 385autofs_dirent_reclen(const char *name) 386{ --- 330 unchanged lines hidden --- |