cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

rnbd-srv-dev.h (1594B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * RDMA Network Block Driver
      4 *
      5 * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
      6 * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
      7 * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
      8 */
      9#ifndef RNBD_SRV_DEV_H
     10#define RNBD_SRV_DEV_H
     11
     12#include <linux/fs.h>
     13#include "rnbd-proto.h"
     14
     15struct rnbd_dev {
     16	struct block_device	*bdev;
     17	fmode_t			blk_open_flags;
     18	char			name[BDEVNAME_SIZE];
     19};
     20
     21/**
     22 * rnbd_dev_open() - Open a device
     23 * @path:	path to open
     24 * @flags:	open flags
     25 */
     26struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags);
     27
     28/**
     29 * rnbd_dev_close() - Close a device
     30 */
     31void rnbd_dev_close(struct rnbd_dev *dev);
     32
     33void rnbd_endio(void *priv, int error);
     34
     35static inline int rnbd_dev_get_max_segs(const struct rnbd_dev *dev)
     36{
     37	return queue_max_segments(bdev_get_queue(dev->bdev));
     38}
     39
     40static inline int rnbd_dev_get_max_hw_sects(const struct rnbd_dev *dev)
     41{
     42	return queue_max_hw_sectors(bdev_get_queue(dev->bdev));
     43}
     44
     45static inline int rnbd_dev_get_secure_discard(const struct rnbd_dev *dev)
     46{
     47	return bdev_max_secure_erase_sectors(dev->bdev);
     48}
     49
     50static inline int rnbd_dev_get_max_discard_sects(const struct rnbd_dev *dev)
     51{
     52	return bdev_max_discard_sectors(dev->bdev);
     53}
     54
     55static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
     56{
     57	return bdev_get_queue(dev->bdev)->limits.discard_granularity;
     58}
     59
     60static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
     61{
     62	return bdev_discard_alignment(dev->bdev);
     63}
     64
     65#endif /* RNBD_SRV_DEV_H */