mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 11:40:25 +03:00
Remove reverse indentation from zed comments.
Remove all occurrences of reverse indentation from zed comments for consistency within the project code base. Signed-off-by: Chris Dunlap <cdunlap@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2695
This commit is contained in:
parent
6d9036f350
commit
5043deaa40
@ -92,7 +92,9 @@ _setup_sig_handlers(void)
|
||||
/*
|
||||
* Lock all current and future pages in the virtual memory address space.
|
||||
* Access to locked pages will never be delayed by a page fault.
|
||||
*
|
||||
* EAGAIN is tested up to max_tries in case this is a transient error.
|
||||
*
|
||||
* Note that memory locks are not inherited by a child created via fork()
|
||||
* and are automatically removed during an execve(). As such, this must
|
||||
* be called after the daemon fork()s (when running in the background).
|
||||
@ -121,6 +123,7 @@ _lock_memory(void)
|
||||
|
||||
/*
|
||||
* Start daemonization of the process including the double fork().
|
||||
*
|
||||
* The parent process will block here until _finish_daemonize() is called
|
||||
* (in the grandchild process), at which point the parent process will exit.
|
||||
* This prevents the parent process from exiting until initialization is
|
||||
@ -182,6 +185,7 @@ _start_daemonize(void)
|
||||
|
||||
/*
|
||||
* Finish daemonization of the process by closing stdin/stdout/stderr.
|
||||
*
|
||||
* This must be called at the end of initialization after all external
|
||||
* communication channels are established and accessible.
|
||||
*/
|
||||
|
@ -86,6 +86,7 @@ nomem:
|
||||
|
||||
/*
|
||||
* Destroy the configuration [zcp].
|
||||
*
|
||||
* Note: zfs_hdl & zevent_fd are destroyed via zed_event_fini().
|
||||
*/
|
||||
void
|
||||
@ -126,6 +127,7 @@ zed_conf_destroy(struct zed_conf *zcp)
|
||||
|
||||
/*
|
||||
* Display command-line help and exit.
|
||||
*
|
||||
* If [got_err] is 0, output to stdout and exit normally;
|
||||
* otherwise, output to stderr and exit with a failure status.
|
||||
*/
|
||||
@ -307,6 +309,7 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
|
||||
|
||||
/*
|
||||
* Parse the configuration file into the configuration [zcp].
|
||||
*
|
||||
* FIXME: Not yet implemented.
|
||||
*/
|
||||
void
|
||||
@ -320,8 +323,10 @@ zed_conf_parse_file(struct zed_conf *zcp)
|
||||
* Scan the [zcp] script_dir for files to exec based on the event class.
|
||||
* Files must be executable by user, but not writable by group or other.
|
||||
* Dotfiles are ignored.
|
||||
*
|
||||
* Return 0 on success with an updated set of scripts,
|
||||
* or -1 on error with errno set.
|
||||
*
|
||||
* FIXME: Check if script_dir and all parent dirs are secure.
|
||||
*/
|
||||
int
|
||||
@ -430,9 +435,11 @@ zed_conf_scan_dir(struct zed_conf *zcp)
|
||||
/*
|
||||
* Write the PID file specified in [zcp].
|
||||
* Return 0 on success, -1 on error.
|
||||
*
|
||||
* This must be called after fork()ing to become a daemon (so the correct PID
|
||||
* is recorded), but before daemonization is complete and the parent process
|
||||
* exits (for synchronization with systemd).
|
||||
*
|
||||
* FIXME: Only update the PID file after verifying the PID previously stored
|
||||
* in the PID file no longer exists or belongs to a foreign process
|
||||
* in order to ensure the daemon cannot be started more than once.
|
||||
@ -497,6 +504,7 @@ zed_conf_write_pid(struct zed_conf *zcp)
|
||||
/*
|
||||
* Open and lock the [zcp] state_file.
|
||||
* Return 0 on success, -1 on error.
|
||||
*
|
||||
* FIXME: If state_file exists, verify ownership & permissions.
|
||||
* FIXME: Move lock to pid_file instead.
|
||||
*/
|
||||
@ -577,11 +585,9 @@ zed_conf_open_state(struct zed_conf *zcp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the opened [zcp] state_file to obtain the eid & etime
|
||||
* of the last event processed.
|
||||
* Write the state from the last event to the [eidp] & [etime] args
|
||||
* passed by reference.
|
||||
* Note that etime[] is an array of size 2.
|
||||
* Read the opened [zcp] state_file to obtain the eid & etime of the last event
|
||||
* processed. Write the state from the last event to the [eidp] & [etime] args
|
||||
* passed by reference. Note that etime[] is an array of size 2.
|
||||
* Return 0 on success, -1 on error.
|
||||
*/
|
||||
int
|
||||
@ -631,8 +637,7 @@ zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[])
|
||||
|
||||
/*
|
||||
* Write the [eid] & [etime] of the last processed event to the opened
|
||||
* [zcp] state_file.
|
||||
* Note that etime[] is an array of size 2.
|
||||
* [zcp] state_file. Note that etime[] is an array of size 2.
|
||||
* Return 0 on success, -1 on error.
|
||||
*/
|
||||
int
|
||||
|
@ -88,6 +88,7 @@ zed_event_fini(struct zed_conf *zcp)
|
||||
* Seek to the event specified by [saved_eid] and [saved_etime].
|
||||
* This protects against processing a given event more than once.
|
||||
* Return 0 upon a successful seek to the specified event, or -1 otherwise.
|
||||
*
|
||||
* A zevent is considered to be uniquely specified by its (eid,time) tuple.
|
||||
* The unsigned 64b eid is set to 1 when the kernel module is loaded, and
|
||||
* incremented by 1 for each new event. Since the state file can persist
|
||||
@ -429,6 +430,7 @@ _zed_event_value_is_hex(const char *name)
|
||||
* Convert the nvpair [nvp] to a string which is added to the environment
|
||||
* of the child process.
|
||||
* Return 0 on success, -1 on error.
|
||||
*
|
||||
* FIXME: Refactor with cmd/zpool/zpool_main.c:zpool_do_events_nvprint()?
|
||||
*/
|
||||
static void
|
||||
@ -640,6 +642,7 @@ _zed_event_add_var(uint64_t eid, zed_strings_t *zsp, const char *fmt, ...)
|
||||
/*
|
||||
* Restrict various environment variables to safe and sane values
|
||||
* when constructing the environment for the child process.
|
||||
*
|
||||
* Reference: Secure Programming Cookbook by Viega & Messier, Section 1.1.
|
||||
*/
|
||||
static void
|
||||
@ -670,6 +673,7 @@ _zed_event_add_env_restrict(uint64_t eid, zed_strings_t *zsp)
|
||||
/*
|
||||
* Preserve specified variables from the parent environment
|
||||
* when constructing the environment for the child process.
|
||||
*
|
||||
* Reference: Secure Programming Cookbook by Viega & Messier, Section 1.1.
|
||||
*/
|
||||
static void
|
||||
@ -718,9 +722,9 @@ _zed_event_get_subclass(const char *class)
|
||||
/*
|
||||
* Convert the zevent time from a 2-element array of 64b integers
|
||||
* into a more convenient form:
|
||||
* TIME_SECS is the second component of the time.
|
||||
* TIME_NSECS is the nanosecond component of the time.
|
||||
* TIME_STRING is an almost-RFC3339-compliant string representation.
|
||||
* - TIME_SECS is the second component of the time.
|
||||
* - TIME_NSECS is the nanosecond component of the time.
|
||||
* - TIME_STRING is an almost-RFC3339-compliant string representation.
|
||||
*/
|
||||
static void
|
||||
_zed_event_add_time_strings(uint64_t eid, zed_strings_t *zsp, int64_t etime[])
|
||||
|
@ -83,6 +83,7 @@ _zed_exec_create_env(zed_strings_t *zsp)
|
||||
/*
|
||||
* Fork a child process to handle event [eid]. The program [prog]
|
||||
* in directory [dir] is executed with the envionment [env].
|
||||
*
|
||||
* The file descriptor [zfd] is the zevent_fd used to track the
|
||||
* current cursor location within the zevent nvlist.
|
||||
*/
|
||||
@ -157,13 +158,16 @@ restart:
|
||||
/*
|
||||
* Process the event [eid] by synchronously invoking all scripts with a
|
||||
* matching class prefix.
|
||||
*
|
||||
* Each executable in [scripts] from the directory [dir] is matched against
|
||||
* the event's [class], [subclass], and the "all" class (which matches
|
||||
* all events). Every script with a matching class prefix is invoked.
|
||||
* The NAME=VALUE strings in [envs] will be passed to the script as
|
||||
* environment variables.
|
||||
*
|
||||
* The file descriptor [zfd] is the zevent_fd used to track the
|
||||
* current cursor location within the zevent nvlist.
|
||||
*
|
||||
* Return 0 on success, -1 on error.
|
||||
*/
|
||||
int
|
||||
|
@ -203,6 +203,7 @@ zed_file_close_from(int lowfd)
|
||||
* Set the CLOEXEC flag on file descriptor [fd] so it will be automatically
|
||||
* closed upon successful execution of one of the exec functions.
|
||||
* Return 0 on success, or -1 on error.
|
||||
*
|
||||
* FIXME: No longer needed?
|
||||
*/
|
||||
int
|
||||
|
@ -87,6 +87,7 @@ zed_log_pipe_open(void)
|
||||
|
||||
/*
|
||||
* Close the read-half of the daemonize pipe.
|
||||
*
|
||||
* This should be called by the child after fork()ing from the parent since
|
||||
* the child will never read from this pipe.
|
||||
*/
|
||||
@ -108,8 +109,10 @@ zed_log_pipe_close_reads(void)
|
||||
|
||||
/*
|
||||
* Close the write-half of the daemonize pipe.
|
||||
*
|
||||
* This should be called by the parent after fork()ing its child since the
|
||||
* parent will never write to this pipe.
|
||||
*
|
||||
* This should also be called by the child once initialization is complete
|
||||
* in order to signal the parent that it can safely exit.
|
||||
*/
|
||||
@ -132,6 +135,7 @@ zed_log_pipe_close_writes(void)
|
||||
/*
|
||||
* Block on reading from the daemonize pipe until signaled by the child
|
||||
* (via zed_log_pipe_close_writes()) that initialization is complete.
|
||||
*
|
||||
* This should only be called by the parent while waiting to exit after
|
||||
* fork()ing the child.
|
||||
*/
|
||||
|
@ -47,8 +47,7 @@ typedef struct zed_strings_node zed_strings_node_t;
|
||||
|
||||
/*
|
||||
* Compare zed_strings_node_t nodes [x1] and [x2].
|
||||
* As required for the AVL tree, return exactly
|
||||
* -1 for <, 0 for ==, and +1 for >.
|
||||
* As required for the AVL tree, return -1 for <, 0 for ==, and +1 for >.
|
||||
*/
|
||||
static int
|
||||
_zed_strings_node_compare(const void *x1, const void *x2)
|
||||
@ -118,6 +117,7 @@ zed_strings_destroy(zed_strings_t *zsp)
|
||||
/*
|
||||
* Add a copy of the string [s] to the container [zsp].
|
||||
* Return 0 on success, or -1 on error.
|
||||
*
|
||||
* FIXME: Handle dup strings.
|
||||
*/
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user