scripts/check_format.sh: catch misaligned comments

Fix up the existing comment blocks misaligned in the first column.

Also add line numbers to the comment checks.

Change-Id: I9d28c365271df36e7013d74cbb02d0023ab4f581
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-04-25 10:35:22 -07:00
parent 2a0d341f98
commit 5639b965ac
15 changed files with 181 additions and 203 deletions

View File

@ -184,15 +184,13 @@ struct spdk_scsi_dev {
};
/**
\brief Represents a SCSI LUN.
LUN modules will implement the function pointers specifically for the LUN
type. For example, NVMe LUNs will implement scsi_execute to translate
the SCSI task to an NVMe command and post it to the NVMe controller.
malloc LUNs will implement scsi_execute to translate the SCSI task and
copy the task's data into or out of the allocated memory buffer.
* \brief Represents a SCSI LUN.
*
* LUN modules will implement the function pointers specifically for the LUN
* type. For example, NVMe LUNs will implement scsi_execute to translate
* the SCSI task to an NVMe command and post it to the NVMe controller.
* malloc LUNs will implement scsi_execute to translate the SCSI task and
* copy the task's data into or out of the allocated memory buffer.
*/
struct spdk_scsi_lun {
/** LUN id for this logical unit. */
@ -244,20 +242,18 @@ int spdk_scsi_dev_allocate_io_channels(struct spdk_scsi_dev *dev);
void spdk_scsi_dev_free_io_channels(struct spdk_scsi_dev *dev);
/**
\brief Constructs a SCSI device object using the given parameters.
\param name Name for the SCSI device.
\param queue_depth Queue depth for the SCSI device. This queue depth is
a combined queue depth for all LUNs in the device.
\param lun_list List of LUN objects for the SCSI device. Caller is
responsible for managing the memory containing this list.
\param lun_id_list List of LUN IDs for the LUN in this SCSI device. Caller is
responsible for managing the memory containing this list.
lun_id_list[x] is the LUN ID for lun_list[x].
\param num_luns Number of entries in lun_list and lun_id_list.
\return The constructed spdk_scsi_dev object.
* \brief Constructs a SCSI device object using the given parameters.
*
* \param name Name for the SCSI device.
* \param queue_depth Queue depth for the SCSI device. This queue depth is
* a combined queue depth for all LUNs in the device.
* \param lun_list List of LUN objects for the SCSI device. Caller is
* responsible for managing the memory containing this list.
* \param lun_id_list List of LUN IDs for the LUN in this SCSI device. Caller is
* responsible for managing the memory containing this list.
* lun_id_list[x] is the LUN ID for lun_list[x].
* \param num_luns Number of entries in lun_list and lun_id_list.
* \return The constructed spdk_scsi_dev object.
*/
struct spdk_scsi_dev *spdk_scsi_dev_construct(const char *name,
char *lun_name_list[],

View File

@ -51,37 +51,36 @@
#include "spdk/scsi_spec.h"
/** \page block_backend_modules Block Device Backend Modules
To implement a backend block device driver, a number of functions
dictated by struct spdk_bdev_fn_table must be provided.
The module should register itself using SPDK_BDEV_MODULE_REGISTER or
SPDK_VBDEV_MODULE_REGISTER to define the parameters for the module.
Use SPDK_BDEV_MODULE_REGISTER for all block backends that are real disks.
Any virtual backends such as RAID, partitioning, etc. should use
SPDK_VBDEV_MODULE_REGISTER.
<hr>
In the module initialization code, the config file sections can be parsed to
acquire custom configuration parameters. For example, if the config file has
a section such as below:
<blockquote><pre>
[MyBE]
MyParam 1234
</pre></blockquote>
The value can be extracted as the example below:
<blockquote><pre>
struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "MyBe");
int my_param = spdk_conf_section_get_intval(sp, "MyParam");
</pre></blockquote>
The backend initialization routine also need to create "disks". A virtual
representation of each LUN must be constructed. Mainly a struct spdk_bdev
must be passed to the bdev database via spdk_bdev_register().
*
* To implement a backend block device driver, a number of functions
* dictated by struct spdk_bdev_fn_table must be provided.
*
* The module should register itself using SPDK_BDEV_MODULE_REGISTER or
* SPDK_VBDEV_MODULE_REGISTER to define the parameters for the module.
*
* Use SPDK_BDEV_MODULE_REGISTER for all block backends that are real disks.
* Any virtual backends such as RAID, partitioning, etc. should use
* SPDK_VBDEV_MODULE_REGISTER.
*
* <hr>
*
* In the module initialization code, the config file sections can be parsed to
* acquire custom configuration parameters. For example, if the config file has
* a section such as below:
* <blockquote><pre>
* [MyBE]
* MyParam 1234
* </pre></blockquote>
*
* The value can be extracted as the example below:
* <blockquote><pre>
* struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "MyBe");
* int my_param = spdk_conf_section_get_intval(sp, "MyParam");
* </pre></blockquote>
*
* The backend initialization routine also need to create "disks". A virtual
* representation of each LUN must be constructed. Mainly a struct spdk_bdev
* must be passed to the bdev database via spdk_bdev_register().
*/
/** Block device module */

View File

@ -132,10 +132,6 @@ static void spdk_reactor_construct(struct spdk_reactor *w, uint32_t lcore,
static struct spdk_mempool *g_spdk_event_mempool[SPDK_MAX_SOCKET];
/** \file
*/
static struct spdk_reactor *
spdk_reactor_get(uint32_t lcore)
{
@ -221,11 +217,10 @@ spdk_event_queue_run_batch(uint32_t lcore)
}
/**
\brief Set current reactor thread name to "reactor <cpu #>".
This makes the reactor threads distinguishable in top and gdb.
*
* \brief Set current reactor thread name to "reactor <cpu #>".
*
* This makes the reactor threads distinguishable in top and gdb.
*/
static void set_reactor_thread_name(uint32_t lcore)
{
@ -277,25 +272,25 @@ _spdk_poller_unregister_complete(struct spdk_poller *poller)
}
/**
\brief This is the main function of the reactor thread.
\code
while (1)
if (events to run)
dequeue and run a batch of events
if (active pollers)
run the first poller in the list and move it to the back
if (first timer poller has expired)
run the first timer poller and reinsert it in the timer list
if (idle for at least SPDK_REACTOR_SPIN_TIME_US)
sleep until next timer poller is scheduled to expire
\endcode
*
* \brief This is the main function of the reactor thread.
*
* \code
*
* while (1)
* if (events to run)
* dequeue and run a batch of events
*
* if (active pollers)
* run the first poller in the list and move it to the back
*
* if (first timer poller has expired)
* run the first timer poller and reinsert it in the timer list
*
* if (idle for at least SPDK_REACTOR_SPIN_TIME_US)
* sleep until next timer poller is scheduled to expire
* \endcode
*
*/
static int
_spdk_reactor_run(void *arg)

View File

@ -292,20 +292,18 @@ int spdk_initialize_iscsi_conns(void)
}
/**
\brief Create an iSCSI connection from the given parameters and schedule it
on a reactor.
\code
# identify reactor where the new connections work item will be scheduled
reactor = spdk_iscsi_conn_allocate_reactor()
allocate spdk_iscsi_conn object
initialize spdk_iscsi_conn object
schedule iSCSI connection work item on reactor
\endcode
* \brief Create an iSCSI connection from the given parameters and schedule it
* on a reactor.
*
* \code
*
* # identify reactor where the new connections work item will be scheduled
* reactor = spdk_iscsi_conn_allocate_reactor()
* allocate spdk_iscsi_conn object
* initialize spdk_iscsi_conn object
* schedule iSCSI connection work item on reactor
*
* \endcode
*/
int
spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
@ -811,20 +809,17 @@ spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match,
}
/**
\brief Reads data for the specified iSCSI connection from its TCP socket.
The TCP socket is marked as non-blocking, so this function may not read
all data requested.
Returns SPDK_ISCSI_CONNECTION_FATAL if the recv() operation indicates a fatal
error with the TCP connection (including if the TCP connection was closed
unexpectedly.
Otherwise returns the number of bytes successfully read.
* \brief Reads data for the specified iSCSI connection from its TCP socket.
*
* The TCP socket is marked as non-blocking, so this function may not read
* all data requested.
*
* Returns SPDK_ISCSI_CONNECTION_FATAL if the recv() operation indicates a fatal
* error with the TCP connection (including if the TCP connection was closed
* unexpectedly.
*
* Otherwise returns the number of bytes successfully read.
*/
int
spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
void *buf)
@ -1016,23 +1011,21 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn)
}
/**
\brief Makes one attempt to flush response PDUs back to the initiator.
Builds a list of iovecs for response PDUs that must be sent back to the
initiator and passes it to writev().
Since the socket is non-blocking, writev() may not be able to flush all
of the iovecs, and may even partially flush one of the iovecs. In this
case, the partially flushed PDU will remain on the write_pdu_list with
an offset pointing to the next byte to be flushed.
Returns 0 if no exceptional error encountered. This includes cases where
there are no PDUs to flush or not all PDUs could be flushed.
Returns -1 if an exception error occurred indicating the TCP connection
should be closed.
* \brief Makes one attempt to flush response PDUs back to the initiator.
*
* Builds a list of iovecs for response PDUs that must be sent back to the
* initiator and passes it to writev().
*
* Since the socket is non-blocking, writev() may not be able to flush all
* of the iovecs, and may even partially flush one of the iovecs. In this
* case, the partially flushed PDU will remain on the write_pdu_list with
* an offset pointing to the next byte to be flushed.
*
* Returns 0 if no exceptional error encountered. This includes cases where
* there are no PDUs to flush or not all PDUs could be flushed.
*
* Returns -1 if an exception error occurred indicating the TCP connection
* should be closed.
*/
static int
spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
@ -1140,25 +1133,23 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
}
/**
\brief Flushes response PDUs back to the initiator.
This function may return without all PDUs having flushed to the
underlying TCP socket buffer - for example, in the case where the
socket buffer is already full.
During normal RUNNING connection state, if not all PDUs are flushed,
then subsequent calls to this routine will eventually flush
remaining PDUs.
During other connection states (EXITING or LOGGED_OUT), this
function will spin until all PDUs have successfully been flushed.
Returns 0 for success.
Returns -1 for an exceptional error indicating the TCP connection
should be closed.
* \brief Flushes response PDUs back to the initiator.
*
* This function may return without all PDUs having flushed to the
* underlying TCP socket buffer - for example, in the case where the
* socket buffer is already full.
*
* During normal RUNNING connection state, if not all PDUs are flushed,
* then subsequent calls to this routine will eventually flush
* remaining PDUs.
*
* During other connection states (EXITING or LOGGED_OUT), this
* function will spin until all PDUs have successfully been flushed.
*
* Returns 0 for success.
*
* Returns -1 for an exceptional error indicating the TCP connection
* should be closed.
*/
static int
spdk_iscsi_conn_flush_pdus(struct spdk_iscsi_conn *conn)
@ -1351,22 +1342,20 @@ spdk_iscsi_conn_full_feature_do_work(void *arg)
}
/**
\brief This is the main routine for the iSCSI 'idle' connection
work item.
This function handles processing of connecitons whose state have
been determined as 'idle' for lack of activity. These connections
no longer reside in the reactor's poller ring, instead they have
been staged into an idle list. This function utilizes the use of
epoll as a non-blocking means to test for new socket connection
events that indicate the connection should be moved back into the
active ring.
While in the idle list, this function must scan these connections
to process required timer based actions that must be maintained
even though the connection is considered 'idle'.
* \brief This is the main routine for the iSCSI 'idle' connection
* work item.
*
* This function handles processing of connecitons whose state have
* been determined as 'idle' for lack of activity. These connections
* no longer reside in the reactor's poller ring, instead they have
* been staged into an idle list. This function utilizes the use of
* epoll as a non-blocking means to test for new socket connection
* events that indicate the connection should be moved back into the
* active ring.
*
* While in the idle list, this function must scan these connections
* to process required timer based actions that must be maintained
* even though the connection is considered 'idle'.
*/
void spdk_iscsi_conn_idle_do_work(void *arg)
{

View File

@ -282,15 +282,13 @@ static void spdk_scsi_lun_hot_remove(void *remove_ctx)
}
/**
\brief Constructs a new spdk_scsi_lun object based on the provided parameters.
\param name Name for the SCSI LUN.
\param blockdev Blockdev associated with this LUN
\return NULL if blockdev == NULL
\return pointer to the new spdk_scsi_lun object otherwise
* \brief Constructs a new spdk_scsi_lun object based on the provided parameters.
*
* \param name Name for the SCSI LUN.
* \param blockdev Blockdev associated with this LUN
*
* \return NULL if blockdev == NULL
* \return pointer to the new spdk_scsi_lun object otherwise
*/
_spdk_scsi_lun *
spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev)

View File

@ -38,8 +38,9 @@ fi
echo -n "Checking comment style..."
git grep -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true
git grep -e '[^ ][*]/' -- '*.[ch]' >> comment.log || true
git grep --line-number -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true
git grep --line-number -e '[^ ][*]/' -- '*.[ch]' >> comment.log || true
git grep --line-number -e '^[*]' -- '*.[ch]' >> comment.log || true
if [ -s comment.log ]; then
echo " Incorrect comment formatting detected"