Veritas™ File System 5.0.1 Programmer's Reference Guide

Index maintenance application
This sample application is for a system that maintains an index of all files in the
file system to enable a fast search similar to the locate program in Linux. The
system needs to update the index periodically, or as required with respect to the
file changes since the last index update. The following lists the basic steps to
perform and shows a sample call to the FCL API.
To prepare the application
1
Enable the FCL.
$ fcladm on mntpt
2
Tune fcl_keeptime and fcl_maxalloc to the required values.
$ vxtunefs —o fcl_keeptime=value
$ vxtunefs —o fcl_maxalloc=value
To test the application
1
Open the FCL file.
$ vxfs_fcl_open(mntpt, 0, &fh);
2
Seek to the end.
$ vxfs_fcl_seek(fh, NULL, FCL_SEEK_END);
3
Get the cookie and store it in a file.
$ vxfs_fcl_getcookie(fh, &cookie)
write(fd, cookie, sizeof(struct fcl_cookie));
4
Create the index.
To update the application
1
Open the FCL file.
$ vxfs_fcl_open(mntpt, 0, &fh);
2
Read the cookie and seek to the cookie.
$ read(fd, &cookie, sizeof(struct fcl_cookie))
$ vxfs_fcl_seek(fh, cookie, FCL_SEEK_COOKIE)
File Change Log
Application programming interface for File Change Log
44